Thursday 15 August 2013

Javascript only when cursor focus within textbox -



Javascript only when cursor focus within textbox -

is possible run javascript function when cursor focus in specific textarea?

i want perform action on keypress of enter key, don't want event listner in place on page, rather when cursor in textarea have (id postcontent)

as example, function i'm using this:

function onenter(){ if(charactercode == 13) { console.log("enter pressed"); } }

just start while work out focus issue...

i have jquery @ disposal.

div1.onfocus= function onenter(){ if(charactercode == 13) { console.log("enter pressed"); } }

javascript

No comments:

Post a Comment