As I said that doesn't work.

On Mar 18, 11:48 am, James <james.gp....@gmail.com> wrote:
> var new_src = $(this).attr("src").replace(imagename, fileObj.name);
>
> will store the String value of that into new_src, so you just set your
> image source to it.
>
> $(this).attr("src", new_src);
>
> On Mar 18, 7:56 am, Chris K <floweringm...@gmail.com> wrote:
>
> > I have the image name in a variable and want to replace it but not
> > sure how to do this.
>
> > Currently I can replace the image src with:
> > var new_src = $(this).attr("src").replace(/ship.png$/i, fileObj.name);
>
> > I want to do something like this (which doesn't work):
> > var new_src = $(this).attr("src").replace(imagename, fileObj.name);
>
> > Any help is appreciated.
>
> > Chris

Reply via email to