Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

jquery change event #13

Open
mmikrut opened this issue Jul 6, 2016 · 1 comment
Open

jquery change event #13

mmikrut opened this issue Jul 6, 2016 · 1 comment

Comments

@mmikrut
Copy link

mmikrut commented Jul 6, 2016

seems like the standard jquery 'change' event is not firing
I created a simple form & jquery code as per below.
the change function gets executed for for name field, but not for the phone.
Am I missing something?

$("#name").change(function(){
debugger;
console.log('NAME-CHANGE: VAL:',$("#name").val());
});

$("#phone").change(function(){
    debugger;
    $("#phone").val($.formatMobilePhoneNumber($("#phone").mobilePhoneNumber('val')))
    console.log('PHONE-CHANGE: VAL:',$("#phone").val());
});
@JamoCA
Copy link

JamoCA commented Mar 7, 2018

It also doesn't appear to be chainable to allow for adding other events. (I store entered values in localstorage for re-use.)

$('#phone').mobilePhoneNumber({allowPhoneWithoutPrefix: '+1'}).change(function(e){
    console.log('phone changed', $(this).val(), new Date);
});

Is their a special event that is created like the country.mobilePhoneNumber event?

UPDATE: It looks like using "blur" to monitor exiting the input field works:

$('#phone').mobilePhoneNumber({allowPhoneWithoutPrefix: '+1'}).blur(function(e){
    console.log('phone changed', $(this).val(), new Date);
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants