Hi all,
Just for clarification, there is only one form on the page at any one
time.
Thank you all for you thoughts. I'm going to try them tonite.
On Jun 2, 9:40 am, mkmanning michaell...@gmail.com wrote:
if you have inputs that are not within forms
That should never happen if you're using
The easiest implementation was Gustavo's.
however, how do i exlcude the submit button?
I guess i can go back and do a single call to remove the class after
the fact.
On Jun 17, 11:47 pm, Loony2nz loony...@gmail.com wrote:
Hi all,
Just for clarification, there is only one form on the page at
The :input selector in ':input,:radio,:checkbox' selects all inputs,
selects, textarea's and buttons, the last two selectors are redundant.
The selector in my last example only selects text inputs, radios and
checkboxes, so it will exclude the submit. Swap it for Gustavo's:
Yes but he only wants to add class to forms. myway is loop through all
forms. or all forms with a specific class. then for each form loop through
all inputs. this way is better only if you want certain forms not to have
the class name or if you have inputs that are not within forms.
On Tue, Jun
Try it:
$('form').find(':input,:radio,:checkbox').addClass('class');
2009/6/2 waseem sabjee waseemsab...@gmail.com
Yes but he only wants to add class to forms. myway is loop through all
forms. or all forms with a specific class. then for each form loop through
all inputs. this way is better
if you have inputs that are not within forms
That should never happen if you're using valid markup ;)
Although the OP gave no indication there'd be other forms on the page,
if you want to target a specific form just use the context:
$(':text,:checkbox,:radio',$('SPECIFIC_FORM')).addClass
script
$(function() {
var myforms = $(form);
myforms.each(function(i) {
var myform = myforms.eq(i);
var myfields = $(input, myform);
myfields.each(function(i) {
var myfield = myfields.eq(i);
myfield.addClass(myflied_+i);
});
});
});
/script
On Mon, Jun 1, 2009 at 7:19 PM, Loony2nz
Or you could just do this:
$(':input,:checkbox,:radio').addClass('YOUR_CLASSNAME');
On Jun 1, 10:24 am, waseem sabjee waseemsab...@gmail.com wrote:
script
$(function() {
var myforms = $(form);
myforms.each(function(i) {
var myform = myforms.eq(i);
var myfields = $(input, myform);
8 matches
Mail list logo