Tuesday, May 22, 2012

jquery shows wrong page

This is the jquery



$(document).on('change', '.ui-slider-switch', function () {

if ($(this).val() == 'on') {
$("#content1").hide();
$("#content2").show();

} else {
$("#content1").show();
$("#content2").hide();
}

});


My HTML



<div id="switch" data-role="fieldcontain">      
<select name="slider" id="flip-a" data-role="slider">
<option value="off"></option>
<option value="on"></option>
</select>
</div>


In my site I sometimes use a custom URL (And get data out of it with $ _GET).
When the page reload I'm always getting $("#content2").show(); instead of $("#content1").show();





No comments:

Post a Comment