Matthew Batt
Matthew Batt

Reputation: 41

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.

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?!

Upvotes: 1

Views: 1711

Answers (1)

Sebastien H.
Sebastien H.

Reputation: 7136

use the "touchstart" event instead the "click".

Upvotes: 1

Related Questions