• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

insert text to end of all textareas

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I would like to add '\r\r' to the end of the textbox entries when the user hits submit. Seems like an easy thing but I cannot find the answers.

I did find some code that inputs it based on the textbox name field but I just want it on all textboxes and inputs on the form.

The form is a mailto in plaintext(dont ask) so I am trying to improve the email layout by adding carriage returns.



Thanks!!
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Save yourself some headaches and use jQuery. The code (off the top of my head so maybe not 100%):
 
premium copy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Save yourself some headaches and use jQuery. The code (off the top of my head so maybe not 100%):



Thanks, it does work but can it be set to work onsubmit? Instead when clicking to the textarea it drops the two carriage returns instead of having the carriage returns after the comments.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Place the code in the form's submit handler:

(Be sure the code is in the onload or ready handler.)
 
premium copy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Place the code in the form's submit handler:

(Be sure the code is in the onload or ready handler.)



I am not sure I caught that...

So



What would would be written within the onsubmit? return myForm();
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

premium copy wrote:What would would be written within the onsubmit? return myForm();


Nothing. Embedding script inside the structural markup is an unsophisticated and naive approach and is not recommend. (Look up Unobtrusive JavaScript).

The .on() method of jQuery handles binding event handlers.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic