Home >Web Front-end >JS Tutorial >[jQuery] Loop through and change the href of a tag
Add "#article" to all a tag links under the info category.
jQuery(document).ready(function($){
$('.info a').each(function(){
let Ahref = $(this).attr("href") + "#article";
$(this).attr("href",Ahref);
});
});
The above is the detailed content of [jQuery] Loop through and change the href of a tag. For more information, please follow other related articles on the PHP Chinese website!