This article mainly brings you a jQuery loop to change the href of a tag (explanation with examples). The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
Add "#article" to all a tag links under the info category.
jQuery(document).ready(function($){ $('.info a').each(function(){ let Ahref = $(this).html() + "#article"; $(this).attr("href",Ahref); }); });
Related recommendations:
Understanding html Anchor text A tag
Basic knowledge of mini program css style media tag detailed explanation
The above is the detailed content of Detailed explanation of jQuery looping through and changing the href of a tag. For more information, please follow other related articles on the PHP Chinese website!