You are viewing limited content. For full access, please sign in.

Question

Question

Forms input field value always contains 0

asked on August 12, 2016

What is it about the following javascript that returns 0, no matter the input entered into the field by the user?

I am using the input (Single Line) field. There are no other fields with this class name.

  $('.testclass').on('blur', 'input', customshowhide);

  
  function customshowhide() {
   
    var input = $('.testclass').val();
    alert(input);

  }

 

0 0

Answer

SELECTED ANSWER
replied on August 12, 2016 Show version history

Just need to change var input = $('.testclass').val();

to var input = $('.testclass input').val();

1 0
replied on August 12, 2016

Thank you! was driving me crazy.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.