Skip navigation
stubbin
Currently Being Moderated

Including JavaScript with a text box when (copying and) pasting.

Apr 17, 2012 6:22 AM

Tags: #script #field

I have a text box in which I have a fair amount of JavaScript, and I'd like to use the textbox in additional places in a document by copying / pasting. When I paste the text box it doesn’t include the JavaScript. I need to use the text box in a couple dozen places, and I’d prefer not to have to have to go into each text box and type the script. Is there anything that can be done to include the script with the pasting? Thanks for any consideration.

 
Replies
  • George Johnson
    11,651 posts
    Aug 11, 2002
    Currently Being Moderated
    Apr 17, 2012 9:12 AM   in reply to stubbin

    That's unusual, but there is a better way. You can create code in document-level JavaScript and call it from a field event. This way, the code in the field can be a single statement that calls the code in the document-level JavaScript, and multiple fields can use the same code.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points