jquery - Using attributes that don't belong (HTML) -
this question has answer here:
- can add custom attribute html tag? 12 answers
let's have table this:
<table> <tr> <td>my house </td> <td>my car </td> </tr> </table>
and using jquery, if clicked on 1 of them, want show value of item. okay practice store additional information in attribute value
example , fetch using .attr()
jquery has .data()
applying data. there data-xxxx
attribute storing data while keeping html valid. whatever method works better you!
Comments
Post a Comment