I\'m using the jQuery quicksand plugin. I need to get the data-id of the clicked item and pass it to a webservice.
How do I get the data-id attribute? I\'m using the .
Important note. Keep in mind, that if you adjust the data-
attribute dynamically via JavaScript it will NOT be reflected in the data()
jQuery function. You have to adjust it via data()
function as well.
link
js:
$(this).data("id") // returns 123
$(this).attr("data-id", "321"); //change the attribute
$(this).data("id") // STILL returns 123!!!
$(this).data("id", "321")
$(this).data("id") // NOW we have 321