Javascript - Text Input Attributes

Posted by bobrusha on Stack Overflow See other posts from Stack Overflow or by bobrusha
Published on 2010-05-26T13:07:05Z Indexed on 2010/05/26 13:11 UTC
Read the original article Hit count: 159

Filed under:
|
|

I need to create a form element

<input disabled type="text" value="smth" />

which is disabled by default. It enables when onmouseover occures.

onmouseover="this.disabled=false;"

And is disabled by onmouseout

onmouseout="this.disabled=true;"


What I need is to check the following. If the <input> is focused then it shouldn't be disabled.

And if the form element loses focus it disables.

Please help me to complete the events.

<input disabled type="text" value="smth" onmouseover="this.disabled=false;" onfocus="???" onblur="???" onmouseout="if(???){this.disabled=true;}" />

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about events