jeudi 19 janvier 2017

Blur event triggers automatically when assigning value conditionally

I'm calling a function on blur event of a < textarea >.

HTML: (Laravel blade template)

<textarea class="form-control" required></textarea>

Javascript:

$( document ).ready(function() {
    $(document).on('blur', 'textarea', function() {
        alert('Blur event triggered');
    });
});

Issue:

The blur event for that < textarea > triggers as soon as I visit the page. It should only trigger when I lost focus from that textarea(like standard blur event).

I figure out that issue occurs when I'm assignging value conditionaly for that < textarea >.




from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iMoA4M
via IFTTT

Aucun commentaire:

Enregistrer un commentaire