0

I'm trying something like this:

<textarea onFocus = "myFunction(1)" onBlur = "myFunction(0); return submitform();">

Is this possible?

1
  • The function you run can call multiple functions as the syntax you have there does. What's the problem? Commented Mar 20, 2014 at 8:57

3 Answers 3

2

Yes but the syntax is wrong, see this edited textarea:

 <textarea onfocus="myFunction(1);" onblur="myFunction(0); return submitform();">
             ^------                  ^-------- small letter is important

A yet better way would be to attach jQuery event handlers, or similiar with a different preferred framework.

Sign up to request clarification or add additional context in comments.

8 Comments

note : attaching events to elements is also possible in pure JS without frameworks
HTML attribute names are case insensitive.
@Quentin in XHTML, onFocus is invalid: You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element.
@DanFromGermany — So what? The question is tagged html not xhtml.
@Quentin xhtml is html too, don't be a nitpicker. It's better to get used to good coding standards than to enforce the bad ones.
|
1

Yes you can. The text between the two "" is actually considered as a function. So it is a unnamed function calls your other functions.

Comments

0

Answer given by @DanFromGermny is right,

you can try this also

<textarea onfocus="myFunction(1);" onblur="(function(){myFunction(0); return submitform();})(event)">

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.