[jQuery] Re: Find and replace image problem

2009-03-18 Thread James
Okay, how about something like: reg = new RegExp('/'+imagename+'$/', 'gi'); new_src = $(this).attr("src").replace(reg, fileObj.name); On Mar 18, 10:00 am, Chris K wrote: > As I said that doesn't work. > > On Mar 18, 11:48 am, James wrote: > > > var new_src = $(this).attr("src").replace(imagen

[jQuery] Re: Find and replace image problem

2009-03-18 Thread Chris K
As I said that doesn't work. On Mar 18, 11:48 am, James 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

[jQuery] Re: Find and replace image problem

2009-03-18 Thread James
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 wrote: > I have the image name in a variable and want to replace it but not >