Patrick
Patrick

Reputation: 2781

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.

Upvotes: 1

Views: 708

Answers (1)

Ren
Ren

Reputation: 330

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>

Upvotes: 1

Related Questions