you should do prepend(...) after html(...). Doing html you replace all the inner html of the $('.' + errId). What you do here is to appen the image and then removing it by changing the html.
The image will be displayed as the first element although you put prepend as last operation: prepend automatically insert the element as the first child (opposite of append that insert the element as the last) On Thu, Aug 27, 2009 at 8:02 AM, Fabio<fabioisc...@gmail.com> wrote: > > Hi Paolo , > > I Tried perpending > > like this > > > var errImg = '/img/errIcon.gif'; > > $("."+errId).attr("style","display: inline; color: red");$ > ("."+errId).prepend('<img src="' + errImg + '"/> ');$ > ("."+errId).html(' Invalid Character. Numerals only.');} > > which should have worked like a magic.. but unfortuneltly something > is causing the image not to render ... could u please help me figure > out the issue > > the image is placed under the web content/themes/img/errorIcon.gif > > Thanks > Fabio > > > > > '<img src="' + errImg + '"/> ' > On Aug 27, 10:05 am, Fabio <fabioisc...@gmail.com> wrote: >> Hi Paolo , >> >> I tried doing this >> >> {$("."+errId).attr("style","display: inline; color: red");$ >> ("."+errId).html("<img src="+contextpath+"/theme/img/errorIcon.gif/ >> >> > Invalid Character. Numerals only.");} >> >> since the image is not picking up from the /img/ folder .... i am >> trying to access with a help of the context path .Or is there a work >> around for this . >> >> early reply would be appreciated. >> >> Thanks >> Fabio >> >> On Aug 26, 11:29 pm, Paolo Chiodi <chiod...@gmail.com> wrote: >> >> >> >> > $("."+errId).prepend('<img .... />'); >> >> > On Wed, Aug 26, 2009 at 5:45 AM, Fabio<fabioisc...@gmail.com> wrote: >> > > $("."+errId)