Shouldn't this be done in the document fragment instead of the actual DOM? Also is there cheaper selector or selector + filter combination? There could be a lot of links in the mobile menu so ideally would narrow more first before searching for links with href attributes that start with the pound sign.