jquery - How to check what button is clicked in this case -
jquery - How to check what button is clicked in this case -
i have html (generated dynamically)
<button type="button" class="btn bluish savepopup t1">save changes</button> <button type="button" class="btn bluish savepopup t2">save changes</button> <button type="button" class="btn bluish savepopup t3">save changes</button> $(document).on("click", ".savepopup", function (e) { var tvalue= $(this).attr('class'); });
i need set status in javascript
if(tvalue=='t1') { } else if(tvalue=='t2') { } else if(tvalue=='t3') { }
http://jsfiddle.net/vz58n67r/
could please help me .
thank much .
this should trick:
$(document).on("click", ".savepopup", function (e){ e.preventdefault(); if($(this).hasclass("t1")){ } else if($(this).hasclass("t2")) { } else if($(this).hasclass("t3")) { } });
jquery
Comments
Post a Comment