javascript - JQuery Mobile prevent radio from being checked -
i make simple radio group using jquery mobile in way:
<fieldset id="current_status" data-role="controlgroup" data-type="horizontal"> {% 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 validate changing, tried use 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 computer browser works. in mobile browser changing isn't prevented. problem here?
i assume problem mobile browser doesn't trigger click event, instead touch/tap event or such.
there's event called "vclick" in jquery mobile address problem.
but in case might smarter idea listen value change of input fields.
$('#current_status input').on('change',function(event){ event.stoppropagation(); event.preventdefault(); changestatus($(this)); return false; });
Comments
Post a Comment