<a class="btn conversation" href="/contact1"> </a>
<a class="btn conversation" href="/contact2"> </a>
<a class="btn conversation" href="/contact3"> </a>
I have a number of buttons with a special conversation class. I would like to attach the value ?open_deals to all these buttons’s href attribute.
$('.conversation').attr('href', $('.conversation').attr('href') + '?open_deals');
I have tried this but all of the buttons get the href value: /contact1?open_deals
I think I have to use $(this) when setting the value. Not sure.
attraccepts a function, jQuery internally iterates through the selected elements, first parameter is the index and second one is the current attribute’s value of each element.