I need to store event target elements in db/localstorage, on reload I need to update their properties based on changes. For example: There is red color text originally, but on click, need to change its property to blue color. On reload, blue color should replace the red color from Javascript (jQuery). The issue is, we can't guarantee if the element has id attribute. How can we store element unique identifier in db and later use it for updates?
$("body *").click(function (evt) {
console.log($(this), 'this');
console.log($(evt.target), 'evt target', $(evt.target)[0]);
$(evt.target).css('color', 'blue');
//storing event.target in local storage here. with changed property
}
$("body").ready(function() {
//retrieve elements from db.
});