Is using custom attributes valid?

前端 未结 3 1546
感情败类
感情败类 2021-01-14 00:22

I want to cancel any links and add extra attributes to each one. Below is how I\'ve achieved this.

function anularEnlaces(){
    $(\'nav a\').each(function()         


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-01-14 01:01

    Valid if you are using HTML5, you can add your own custom data attributes data-:

    HTML5 Custom Data Attributes (data-*)

    and you can use jQuery's $.data to read and modify them.

提交回复
热议问题