Re: [jQuery] What would be the best way to...?

2007-02-24 Thread Brian Miller
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(textarea name=' + this.attr(name) + ' + this.val()
 + /textarea).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(textarea name=' + currentName + ' + cuurentValue +
 /textarea;
  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 input type=text elements on a
 page
  with textarea 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...?

2007-02-23 Thread Glen Lipka

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(textarea name=' + currentName + ' + cuurentValue +
/textarea;
 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 input type=text elements on a page
with textarea 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/