I'm trying to bind a click event to an anchor and I can't figure out the right selector... Is bind() particularly picky with selectors?
Here's my code which does not work:
$(".ui-navbar").delegate("a.location-menu-btn", "click", function() {
navigateToPage("location.html", { });
});
The following code does work but causes the whole body to appear like it is being clicked on an Android smartphone (ugly yellow box around the anachor).
$("body").delegate("a.location-menu-btn", "click", function() {
navigateToPage("location.html", { });
});
This is the html:
<div data-role="navbar" class="ui-navbar ui-navbar-noicons" role="navigation">
<ul class="ui-grid-b">
<li class="ui-block-a">
<a href="javascript:void(0)" data-ajax="false" class="search-menu-btn ui-btn ui-btn-up-a" data-theme="a"><span class="ui-btn-inner"><span class="ui-btn-text"><span class="lang-nav-search">Search</span></span></span></a>
</li>
<li class="ui-block-b">
<a href="javascript:void(0)" data-ajax="false" class="location-menu-btn ui-btn ui-btn-up-a" data-theme="a"><span class="ui-btn-inner"><span class="ui-btn-text"><span class="lang-nav-location">Location</span></span></span></a>
</li>
<li class="ui-block-c">
<a href="javascript:void(0)" data-ajax="false" class="settings-menu-btn ui-btn ui-btn-up-a" data-theme="a"><span class="ui-btn-inner"><span class="ui-btn-text"><span class="lang-nav-settings">Settings</span></span></span></a>
</li>
</ul>
</div>