Robert Dickey Robert Dickey - 1 month ago 9
HTML Question

Same page Navigation within a JqueryMobile page

I have a page using Jquery Mobile. I have attempted to use simple anchors

<a href="#section1">Text</a>


<div id="section1">
text
</div>


but it seems like that isn't possible when calling Jquery Mobile. Does anyone know of a usable work around? I've searched for a while and can't seem to find anything that actually works. I'm trying to simply move down to certain sections in the same html document.

Answer

You can use $.mobile.navigate( "#section1" );

<a href="#section1" onclick="$.mobile.navigate( '#section1' );">Text</a>

<div id="section1"> 
text
</div>

Document: https://api.jquerymobile.com/jQuery.mobile.navigate/