Reputation: 883
I want to change my DIV contents on swipe using Jquery mobile.
<div id = 100>
<div id = 101 data-role="page"> ....Content 1....</div>
<div id = 101 data-role="page"> ....Content 2....</div>
<div id = 101 data-role="page"> ....Content 3....</div>
</div>
this works fine. But my problem is I am giving as numeric e.g 101, which is a must requirement for me. Swiping does not work when DIV Id is numeric. It works with alpha or alphanumeric values.
Can anyone help me out..
Upvotes: 0
Views: 57
Reputation: 6132
I would strongly advise against using numeric values for IDs of HTML elements. This can lead to a lot of unintended behavior.
My advise would be to call your div's id something like content_ and then removing the "content_" using jquery when you are loading the content.
Something like this:
var contentID = $('#content_101').attr('id').replace('content_','');
<div id = "content_100">
<div id = "content_101" data-role="page"> ....Content 1....</div>
<div id = "content_102" data-role="page"> ....Content 2....</div>
<div id = "content_103" data-role="page"> ....Content 3....</div>
</div>
Upvotes: 1