Within JQuery I am trying to perform the following
- Find every link on the page
- Where the HREF property starts with '#'
- And the ID value is not 'mobileMenu'
This works perfectly:
$("a[href^='#']").each(function () { // links where HREF starts with #
if ($(this).attr('id') != 'mobileMenu') { // id not equal to mobileMenu
$(this).click(function () {
// logic
})
}
});
But when I try to combine it into a more succinct search, it fails (the mobileMenu link is still pulled into the array):
$("a[href^='#'], a[id!='mobileMenu']").each(function () {
}
What I am doing wrong please?