0

I'm working on a custom field that will store a string. The text will have a custom formatter applied to it that will manipulate the structure of the string (adding dashes in the right places). I have a javascript that will apply those changes in the field's input textbox when creating a new content type with the custom field, but I can't figure out how to fire the javascript when the user enters the text. Can it be done and if so can anyone point me in the right direction?

1
  • show us your code
    – AKS
    Commented Apr 9, 2013 at 20:39

2 Answers 2

1

You probably want to use Drupal behaviors which is a wrapper of sorts for JQuery. With JQuery you can make it so that everytime your textfield gets edited your Javascript code gets executed. Behaviors/JQuery is a big subject and will take time if you're not familiar. You can start here

The Drupal JavaScript API

JQuery tutorials

0
0

1.With the help of onblur() function,you can trigger the written js. 2.onblur() function helps you in calling a js once the text is entered in the input field and the user press ENTER after entering the text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.