The variable fieldName is something that I'am pulling in from
somewhere else.  Here is the full code:
if(val == ''){
var fieldName = $("select[name='fieldcategoryID'] :selected").text();
$("#fieldValue label").fadeIn('slow', function (){
$(this).after("<span class='field-error'>You need to enter a "
+fieldName+" here.</span>");
});
return false;
//Send the data to the servers
}else{

What I would like to do is have the error message fade In above after
the label, if the person enters an empty value in to a input box.  I'm
just unsure what the syntax order is for the fadeIn() and after()
methods.

Thanks for the help.

On Dec 11, 1:03 pm, ksun <kavi.sunda...@gmail.com> wrote:
> >                         $(this).after("<span class='field-error'>You need 
> > to enter a "
> > +fieldName+" here.</span>");
>
> What is "fieldName", you need get that value from somewhere, before
> trying to use it. Also the effect is applied only on the object on
> which it is called, so if your label is hidden then it will appear
> slowly. The span tag will just appear, it will not have the fadeIn
> effect. I am not sure what exactly you are trying to achieve here, but
> hope this helps.
>
> On Dec 11, 11:24 am, WhoButSB <whobu...@gmail.com> wrote:
>
> > Hello all,
> > I have a really simple question but, and once I figure out this little
> > hurdle I know I will be able to work on a lot more stuff.
>
> > I would like to add a simple notification to fade in when some one
> > presses a button but I would like to attach the notification after a
> > label.  I know I have to be really close with this code I just can't
> > figure it out.
>
> > $(function(){
> >         $('#button').click(function(){
> >                 $("#fieldValue label").fadeIn('slow', function (){
> >                         $(this).after("<span class='field-error'>You need 
> > to enter a "
> > +fieldName+" here.</span>");
> >                 });
> >         });
>
> > });
>
> > Thanks for your help!

Reply via email to