简体   繁体   中英

Blur event cancels Click events with jQuery on Mobile device

I have a blur event in a textarea:

$("#question-id-5-answer").blur(function (event) {}

And a click event in the Submit button:

$("#" + _sendBtnId).on("click", function () {} 

It happens that the Click event does not fire because the Blur event cancel the click event.

I can't use the Mousedown event because it's a touch device that does not detect it.

I tried saving the following on my mobile device as a htm file and accessed using Forefox application. Appears to be working as expected. Please have a look if it helps you.

<form id="myForm">
    <textarea id="myTxt"></textarea>
    <input type="button" id="butSubmit" value="Submit" />
</form>

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>

$(document).ready(function() {

    $("#myTxt").blur(function() {
        if($(this).val() != "") {
            alert("retunging false");
            return false;   
        }

        alert("rextarea is empty");
    });

    $("#butSubmit").click(function() {
        alert("submitted");
    });

});

</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM