How to an element in a validator function in parsley.JS

How to an element in a validator function in parsley.JS

I am trying to make a custom validator in parsley.js and currently i have the following:

  1. window.Parsley.addValidator('intlTelNo' , {
  2. requirementType : 'integer',
  3. validateNumber : (val , requirement ) => {
  4. console.log(val);
  5. return true;
  6. },
  7. messages : {
  8. en : 'Please enter a valid phone number.'
  9. }
  10. });

I am using this validator in my HTML like so:

  1. <input type="" name="Phone" placeholder="Phone" id="intl-phone-number" data-parsley-intl-tel-no data-parsley-trigger="focusin focusout" data-parsley-errors-container="#error-container">
My custom validator gets used on the above input because i have specified the following data attribute:

  1. data-parsley-intl-tel-no
ofcourse i am returning true as of now in my custom validator so the tests always passes, but what i really want to do is check if the value of the input is a valid phone number and for that i need to access the input itself (Yes the input itself and not just the value as i am using some third party JS library that needs the input and not just the value ). 

Now , How do i pass the input into the below function ?

  1. validateNumber : (val , requirement ) => {
  2. console.log(val);
  3. return true;
  4. },
Is there some javascript magic technique that i can use ? as right now i am just sitting here scratching my head :| . Would really appreciate any help :)

P.S. An example of how to make a custom validator can be seen HERE.