1

I am facing problem while counting number of input elements in document,i have written some code but it does not seems to work,Please help me.

 $('#Q1_7_label').parents('TR').hide();
 $('#forwardbutton').click(function()
 {
    var x=$(this).find('input').length;
    alert(x)
 });

1 Answer 1

2
$(this).find('input').length

will count the input elements inside #forwardbutton, which, given the element's name, is probably 0.

If you want to count all, then select all:

$('input').length
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.