Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
Thursday, January 21, 2016
jQuery remove data attribute and add data attribute
Suppose we have data attribute id, value 76
<tr class="worksheet" data-id="76"></tr>
To remove data attribute id in jQuery
$('.worksheet').removeData("id");
To add data attribute id in jQuery
$('.worksheet').attr("data-id","");
Get value:
$('.worksheet').data("id");
Set value
$('.worksheet').data("id","");
For some reason set value not working well, I use remove data attribute and add data attribute instead.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment