[jQuery] Re: Append asterisk to required field labels

2009-04-07 Thread Baum
The author of xVal released a changeset that supported 1.3.2...and that resolved the issue. Thanks for the example $.each loop. That was the code I was looking for to only affect labels for required fields. Baum On Apr 3, 1:54 pm, Baum wrote: > James, > > Maybe it is a question of timing? > > W

[jQuery] Re: Append asterisk to required field labels

2009-04-03 Thread Baum
James, Maybe it is a question of timing? When I hard-coded class="required" on the input fields I received the desired effect. However, I want to get this effect based on business rules on my object model. Version 1.3.2 that comes as part of the asp.net mvc releases does not contain any changes

[jQuery] Re: Append asterisk to required field labels

2009-04-03 Thread Baum
No. This is my first project with jQuery. I used your (James, March 31) code directly and that is the only jQuery call used in the entire site. I happened to have some asp.net MVC samples that used 1.2.6 and I switched the reference to use the 1.2.6 version and the code worked as expected. I will

[jQuery] Re: Append asterisk to required field labels

2009-04-01 Thread JT
Example using CSS. YOUR HTML First Name YOUR CSS label.required:after { content: ' *'; } RESULT: First Name * OR label.required:before { content: '* '; } RESULT: * First Name

[jQuery] Re: Append asterisk to required field labels

2009-04-01 Thread RobG
On Apr 1, 10:56 am, Baum wrote: > Hi, > > I am looking to use jQuery in conjunction with xVal for validation. > One of the cool things I though jQuery would allow me to do is append > an asterisk (*) to the label of "ALL" my fields that have a css class > of "required". The example below only a

[jQuery] Re: Append asterisk to required field labels

2009-04-01 Thread James
I'm not sure what the asp.net MVC release of jquery is and if it's been modified from the original, but on my 1.3.2 (from jquery.com), the code works. So there is no problem with jQuery 1.3.2 regarding each (). There must be something else that's causing the issue. Do you still have somewhere in y

[jQuery] Re: Append asterisk to required field labels

2009-03-31 Thread Baum
Thanks James. I am just getting started with jQuery so the syntax is rather new. What I found is that the jquery-1.3.2.js file that I am using as part of the asp.net MVC release does not appear to work with each syntax (I only get the first input field back). I reverted back to 1.2.6 and it appea

[jQuery] Re: Append asterisk to required field labels

2009-03-31 Thread James
How about something like: $required = $(".required"); // list of elements with 'required' class. $.each($required, function(i) { var id = $(this).attr('id'); var $label = $("label[for="+id+"]"); $label.text( $label.text()+'*' ); }); The requirement is that all your .required input

[jQuery] Re: Append asterisk to required field labels

2009-03-31 Thread Baum
One note the javascript included in the original post is incorrect...I was playing around and pasted the wrong copy...remove the each(). Also var size = $(".required").size(); is equal to 1 but var size = $ ("input").size(); is equal to 2. Thanks. On Mar 31, 7:56 pm, Baum wrote: > Hi, > > I am