How to add an attribute (or change) to children elements?
I am using this simple script to add the target="_blank" attribute to all
the elements.
$(function(){
$('a').attr('target', '_blank');
});
It is working great but I want only the <a> in the <div id="main"> to be
affected by this script.
I tried :
$('#main').$('a').attr('target', '_blank');
But this is just not working....
No comments:
Post a Comment