Re: [jQuery] What would be the best way to...?
Thanks for the advice, I should have figured it was that easy. Although, you both didn't wrap "this" in a $() before using jQuery methods on it. :) I'll use it this week. - Brian > $("[EMAIL PROTECTED]").each(function(i){ > this.append("" + this.val() > + "").remove() > }) > > is a bit shorter... and throwing the remove at the end of the chain > will save you a small fraction of a millisecond! > > I just took Glen's code and shortened it. I've used the append and > remove before. > > On 2/23/07, Glen Lipka <[EMAIL PROTECTED]> wrote: >> I havent tested, but this is in the ballpark I think: >> $("[EMAIL PROTECTED]").each(function(i){ >> >> currentName = this.attr("name"); >> currentValue = this.val(); >> this.append("" + cuurentValue + >> "; >> this.remove >> (); >> }); >> So this would destroy the input and replace with textarea. >> There might be a better way, but I "think" this should work. >> >> Glen >> >> >> >> On 2/23/07, Brian Miller <[EMAIL PROTECTED]> wrote: >> > I need to replace a whole lot of elements on a >> page >> > with elements. (I have limited control over how the fields >> are >> > generated.) The contents of the form fields must remain - I just want >> to >> > change the "shape" of the field to make it bigger and allow multiline >> > input. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] What would be the best way to...?
$("[EMAIL PROTECTED]").each(function(i){ this.append("" + this.val() + "").remove() }) is a bit shorter... and throwing the remove at the end of the chain will save you a small fraction of a millisecond! I just took Glen's code and shortened it. I've used the append and remove before. On 2/23/07, Glen Lipka <[EMAIL PROTECTED]> wrote: > I havent tested, but this is in the ballpark I think: > $("[EMAIL PROTECTED]").each(function(i){ > > currentName = this.attr("name"); > currentValue = this.val(); > this.append("" + cuurentValue + > "; > this.remove > (); > }); > So this would destroy the input and replace with textarea. > There might be a better way, but I "think" this should work. > > Glen > > > > On 2/23/07, Brian Miller <[EMAIL PROTECTED]> wrote: > > I need to replace a whole lot of elements on a page > > with elements. (I have limited control over how the fields are > > generated.) The contents of the form fields must remain - I just want to > > change the "shape" of the field to make it bigger and allow multiline > > input. > > > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] What would be the best way to...?
I havent tested, but this is in the ballpark I think: $("[EMAIL PROTECTED]").each(function(i){ currentName = this.attr("name"); currentValue = this.val(); this.append("" + cuurentValue + "; this.remove(); }); So this would destroy the input and replace with textarea. There might be a better way, but I "think" this should work. Glen On 2/23/07, Brian Miller <[EMAIL PROTECTED]> wrote: I need to replace a whole lot of elements on a page with elements. (I have limited control over how the fields are generated.) The contents of the form fields must remain - I just want to change the "shape" of the field to make it bigger and allow multiline input. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] What would be the best way to...?
I need to replace a whole lot of elements on a page with elements. (I have limited control over how the fields are generated.) The contents of the form fields must remain - I just want to change the "shape" of the field to make it bigger and allow multiline input. What would be the best/tersest way to do that? For some reason, it's just not coming to me. Selecting them all is easy enough, but replacing one kind of tag with another is just throwing me off today. Thanks! - Brian ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/