jquery - if i have 5 buttons with same CLASS, can i use javascript onclick to get ID? -
i have 5 buttons set same class "deletebutton"
but each deleton button has unique purpose ( delete different id )
$(".deletebutton").click(function (e){ document.getelementbyid("abc").href="delete.php?adid="; + id of button clicked });
what need modify link of button, based on id of button clicked.
<a id="delete" href="remove.php?adid=" >confirm</a>
i have been having issue this, , think because "deletebutton" function running off class of button knows class not id of specifc button clicked? thoughts?
you can use of these id this.id
or e.target.id
or $(this).attr("id")
$(".deletebutton").click(function (e){ document.getelementbyid("abc").href="delete.php?"+ this.id; });
Comments
Post a Comment