That makes sense. Hadn't thought of that. Thanks.

On May 11, 1:23 pm, waseem sabjee <waseemsab...@gmail.com> wrote:
> var t = $("#myid").text();
> $ ("#myid").text(t.replace(' left in stock','');
> t = $("#myid").text();
> if(t == "1") {
> $ ("#myid").text(t.replace(t,'only '+t+' item remain');} else {
>
> $ ("#myid").text(t.replace(t,t+' items remaining');
>
> }
> On Mon, May 11, 2009 at 5:52 PM, jckos <johncar...@gmail.com> wrote:
>
> > Hi,
>
> > I'm looking to change the text in an element, but I want to keep one
> > of the values in the string the same.  Basically I have an "in stock"
> > number  generated by the JSP that is dynamic but I want to change the
> > message arounn the numberic value.
>
> > For example, I'd like to change "1 left in stock"  to "Only 1
> > Remaining"  where "1" is not replaced.
>
> > I was trying to figure out a way using some kind of regex
> > backreference with text() but I don't think this is possible.  Is
> > there another way?
>
> > Thanks in advance.

Reply via email to