How can I get a HTML data value as a string with jQuery?

后端 未结 7 844
面向向阳花
面向向阳花 2021-01-31 18:02

I have the following in my source HTML:

  • Test
  • I want to get the value of th

    7条回答
    •  谎友^
      谎友^ (楼主)
      2021-01-31 18:23

      const article = document.querySelector('#electric-cars'); article.dataset.columns // "3" article.dataset.indexNumber // "12314" article.dataset.parent // "cars"

    提交回复
    热议问题