[英]jQuery show & hide not working on iPad or iPhone
All the functions in the following code work fine on desktop browsers, but on iPad and iPhone the top 2 functions work but the 3rd (starting $('input#pagebreakhomeNext').click(function () { ) doesn't work at all. 以下代码中的所有功能在桌面浏览器上都可以正常运行,但是在iPad和iPhone上,前2个功能可以正常工作,但是第3个(开始$('input#pagebreakhomeNext')。click(function(){ )根本不起作用。
jQuery.noConflict();
jQuery(document).ready(function($){
$('div.rsform-block-pagebreak input').click(function () {
$(window).scrollTop($('div.calculator').offset().top);
return false;
});
$('a#pagebreaksubmitNext').click(function () {
$(window).scrollTop($('div.calculator').offset().top);
return false;
});
$('input#pagebreakhomeNext').click(function () {
if ($('input#postcode').val() != "") {
var code = $('input#postcode').val();
$.ajax({
url: “URL HIDDEN”,
dataType: "json",
data: 'code='+code,
async: false,
success: function(json) {
if((json.found) && $('input.benefits:checked').val() != "I do not get any of these benefits" && $('input.ownership:checked').val() == "Yes" && $('input.insulation:checked').val() == "Yes" && $('input.walls:checked').val() == "Solid Walls" && $('input.houseage:checked').val() == "Between 1930 and 1976") { $('div.rsform-block-success').hide(); $('div.rsform-block-failure').show(); }
else if((json.found) && $('input.benefits:checked').val() != "I do not get any of these benefits" && $('input.ownership:checked').val() == "Yes" && $('input.insulation:checked').val() == "Yes" && $('input.walls:checked').val() == "Solid Walls" && $('input.houseage:checked').val() == "After 1980") { $('div.rsform-block-success').hide(); $('div.rsform-block-failure').show(); }
else { $('div.rsform-block-success').show(); $('div.rsform-block-failure').hide(); }
}
});
}
});
});
Please can somebody help?! 请有人帮忙吗?
使用“ touchstart”事件代替“ click”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.