Form Selectors in JQuery
- A Form Selector selects the HTML element which has type=input field within the form element.
- It is one of the pseudo-class selectors start with [:].
- We must indicate [input:file] in jquery otherwise it take [*:file].
- Here we can see the example of input tag in html.
<input type="text" value="content" enabled="enebled">
:button
- This jquery selector operates which input type has a button.
- The jquery execute only an element within the form elements.
- A type=button element will pass a signal to alert when the click event execute.
Example
$(document).ready(function () { $(':button').click(function () { alert("hai"); }); });
:checkbox
In this jquery selector perform the checkbox element which declare the input type="checkbox" within form element.
Example
$(document).ready(function () { $(':button').click(function () { alert($(':checkbox').val()); }); });
:checked
- We can use this property for checkbox and radio button that mention in form.
- The checked elements are only manipulated by jquery.
Read More from https://api.jquery.com