2

There are form elements under a div, I do not know the type. It might be checkboxes or radios or select. how to select form elements without specifying the element type under a using jquery?

2 Answers 2

4

Use the :input selector:

$(':input')

Which is basically short hand for:

$('input, select, textarea, button')
Sign up to request clarification or add additional context in comments.

Comments

0

In many case you want to select all form elements but exclude buttons , for that case use

$(":input[type!='submit'][type!='reset']")

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.