Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between :input and input in Jquery

Tags:

jquery

On some tutorials, I've seen these selectors:

$(':input');

or

$('input');

Note the ':'.

Are there any differences?

like image 449
Reinherd Avatar asked Dec 16 '22 15:12

Reinherd


1 Answers

$('input') = with only the element name, selects only HTML elements.

$(':input') = with the colon, selects/filter all form input type elements, including input, select, textarea, and button elements.

Refer to the jQuery selector information:

http://api.jquery.com/category/selectors/

http://api.jquery.com/input-selector/

like image 169
Mohammad Adil Avatar answered Jan 13 '23 01:01

Mohammad Adil