我目前有一个块的jQuery,我已经包括这似乎工作良好的竞争,我已经测试了OSX, XP
,但在移动设备和另一台电脑上,我有人测试它仍然去旧的URL,但我怀疑它可能是一个缓存问题,但有一种方法来开发一个PHP回落?
我想做什么,如果prop2
值被选中,我想改变表单的动作url几乎onclick像jQuery一样。
<form action='bookingurl' method='get'>
<label for='channel_code' class="caption">Select property </label>
<select id='channel_code' name='id'>
<option value='prop1'>Prop 1</option>
<option value='prop2'>Prop 2</option>
</select>
</form>
jQuery: jQuery(document).ready(function(){
jQuery('#channel_code').change(function(){
if(jQuery('#channel_code').val() == 'prop2'){
window.location.href = 'https://hotels.cloudbeds.com/reservation/url';
}
});
});
$(document).ready(function() {
$('#channel_code').change(function() {
if ($('#channel_code option:selected').val() == 'prop2') {
alert("go to")
//window.location.href = 'https://hotels.cloudbeds.com/reservation/url';
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action='bookingurl' method='get'>
<label for='channel_code' class="caption">Select property</label>
<select id='channel_code' name='id'>
<option value='prop1'>Prop 1</option>
<option value='prop2'>Prop 2</option>
</select>
</form>
指定选择器为:
$('#channel_code option:selected').val()
//选项选择值