Javascript only when cursor focus within textbox -


Is it possible to run a JavaScript function when cursor focus is in a specific text?

I want to do one thing on the keypress of the enter key, however I do not want to place this event listator normally on the page, but only when the cursor contains Textarea I have (id postcontent )

As an example, the function I am using is:

  function OnEnter () {if (characterCode == 13) {console.log (press "press"); }}  

Just as a start when I issue Focus ...

In my settlement I also have jQuery.

  div1.onfocus = function onEnter () {if (charactercode == 13) {console .log (press "press"); }}  

Comments

Popular posts from this blog

python - Strange behavior using PyQt4's 'pyqtSlot' decorator before another decorator -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

c# - Process.Kill() returns access denied -