Closed kamlekar closed 8 years ago
I think this is not possible to do with click events as I need to track the clicked element when clicked on document also. For this, I think I need global variables. This concept will work if we consider mousedown
and mouseup
events instead of click
event. We should program manually the clicking behaviour on mousedown
and mouseup
events.
Somehow, completed it myself :D
As shown in the above example element, I am trying to write a small JS library.
Explanation:
data-html-class
is added a class name to the element whose class name or ID is mentioned as value in the attributedata-html-target
.data-html-target
aredata-html-class
value to all classes with the class name provided.ID - adds the
data-html-class
to the id.data-html-target
is not added, thendata-html-class
value gets added to the clicked element itself.