Tim Shier
Tim Shier

Reputation: 11

Updating JQuery Mobile link/href with JQuery

I've hit a frustrating problem and cannot seem to locate a solution to it in conventional searches (apologies if I missed a trick).

I'm using multi-pages and am trying to update the page that a link goes to.

The code:

<a href="#page_${i+1}" id="theNextButton_${i}" data-role="button" rel="external">Next</a>

 $("#page_"+counter).attr("ahref", "#page_"+(data.index+1 ))

the counter is iterated. data.index+1 is the number of the desired page to go. All pages are sequentially numbered with a #page_ prefix.

Looking inside JS Console and inspecting the link I can see that it updates the link correctly but then clicking on the link leads it to do the initial page transition.

Anybody have any recommendations?

Upvotes: 0

Views: 30

Answers (1)

Jugal Panchal
Jugal Panchal

Reputation: 97

Looks like your jQuery function .attr has invalid attribute name ahref, use href instead.

Upvotes: 1

Related Questions