1

I make a simple radio group using JQuery Mobile in that way:

 <fieldset id="current_status" data-role="controlgroup" data-type="horizontal"> {% for state in states %} <input type="radio" name="state-choice" id="state-{{ state.id }}" value="{{ state.id }}" data-code="{{ state.code }}" {% if state == currentState %}checked="checked"{% endif %} /> <label for="state-{{ state.id }}">{{ state.description }}</label> {% endfor %} </fieldset> 

I need to validate changing, so I tried to use everything like:

 $(document).ready(function() { $('#current_status label').click(function(event) { event.stopPropagation(); event.preventDefault(); changeStatus($(this)); return false; }); $('#current_status input').click(function(event){ event.stopPropagation(); event.preventDefault(); changeStatus($(this)); return false; }); . . . . . . . . . . . . . . . . . . . }); 

In my computer browser it works. But in mobile browser changing isn't prevented. What could be a problem here?

1

1 Answer 1

2

I assume the problem is that your mobile browser doesn't trigger a click event, but instead a touch/tap event or such.

There's an event called "vclick" in jQuery Mobile to address this problem.

But in your case it might be a smarter idea to listen to a value change of your input fields.

$('#current_status input').on('change',function(event){ event.stopPropagation(); event.preventDefault(); changeStatus($(this)); return false; }); 
Sign up to request clarification or add additional context in comments.

1 Comment

True. But instead of a change event I used vmousedown. Also I replaced click with vclick.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.