javascript - How to append data to elements attribute value -
having htmls this,
<a class="testdiv" href="/link1"></a> <a class="testdiv" href="/link2"></a>
i'm trying append ?param1=2
href
attributes of <a>
tags.
so should like,
<a class="testdiv" href="/link1?param1=2"></a> <a class="testdiv" href="/link2?param1=2"></a>
something this,
$(".testdiv").attr('href').append("?param1=2");
is there possible way this?
$(".testdiv").attr('href', function (_, currenthref) { homecoming currenthref +"?param1=2" });
javascript jquery html append
No comments:
Post a Comment