Hello, I need help selecting an a href text inside h1 tag. Here is what it looks like <h1><a href="#"> the is not to be selected</a> and <a href="#">this should be selected</a></h1> <p>please select only the <a href="#">text</a> inside the header a href</p> <h1><a href="#"> the is not to be selected</a> and <a href="#">this should be selected again</a></h1> <p>please select only the <a href="#">text</a> inside the header a href</p> $(document).ready(function(){ $(":header").each(function(){ $("a").each(function(){ $entry = $(this).text(); alert($entry); }); }); }); that code above is not working. Any help is highly appreciated. Thanks
$(document).ready(function() { $("h1 a").each(function() { $entry = $(this).attr("href"); alert($entry); }); }); Code (markup):