thank you!

On May 9, 3:33 am, "Aaron Heimlich" <[EMAIL PROTECTED]> wrote:
> On 5/8/07, Equand <[EMAIL PROTECTED]> wrote:
>
> > $("img", "#preview").attr("src").replace(/\?.*$/g)
> > what's wrong with this?
> > i try to strip of all text after ? and the ?....
>
> replace() returns the modified string instead of directly modifying the
> original one (any method that changes a string in some way does this too),
> so the correct code would be:
>
> $("img", "#preview").each(function() {
>     this.src = this.src.replace(/\?.*$/g);
>
> });
>
> or more "jQuery-ish":
>
> $("img", "#preview").attr("src", function() {return this.src.replace
> (/\?.*$/g);});
>
> seehttp://docs.jquery.com/DOM/Attributes#attr.28_key.2C_fn_.29for more
> info on exactly how I did that.
>
> --
> Aaron Heimlich
> Web Developer
> [EMAIL PROTECTED]://aheimlich.freepgs.com

Reply via email to