This post written by me has more about jquery form filters in details.
In this tutorial we will demonstrate how to select form elements with Jquery filters and apply some CSS changes for it.
- Find all input, select, textarea, and button elements
$("form :input").css("border", "3px solid red");
This will select all input, select, textarea, and button elements and put a red border around it - Find all text elements
$("form :text").css("border", "3px solid red");
This will select all text elements and put a red border around it - Find all radio elements
$("form :radio").css("border", "3px solid red");
This will select all radio button elements and put a red border around it - Find all checkbox elements
$("form :checkbox").css("border", "3px solid red");
This will select all chechbox elements and put a red border around it - Find all submit elements
$("form :submit").css("border", "3px solid red");
This will select all submit elements and put a red border around it - Find all button elements
$("form :button").css("border", "3px solid red");
This will select all button elements and put a red border around it - Find all file update elements
$("form :file").css("border", "3px solid red");
This will select all file elements and put a red border around it
- Find all form elements that are enabled
$("form :text:enabled").css("border", "3px solid red");
This will find out all text elements that are enabled and put a red border around it
- Find all form elements that are ckecked (radiobuttons and checkboxes)
$("form :checked").css("border", "3px solid red");
This will find out all form elements that are checked and put a red border around it$("form :checkbox:checked").css("border", "3px solid red");
This will find out all checkboxes that are checked and put a red border around it
This will find out all form elements that are selected and put a red border around it
From this link you can find the sample files used for this tutorial
Note: Make sure you have added your jquery reference correctly.
If a border doesn't show up use "outline" instead of "border" inside the CSS method.
Please add a comment if something is not clear or you have something to add
No comments:
Post a Comment