Can some one help me..
I have a text box which is readonly by default on page load. On click event of this text box i have to do two things.
- make it editable
- keep focus on text box
For this, i have written a code removeAttr
to make it editable, then focus()
to keep focus on it.
It is working in IE8+, FF, Chrome as expected. But I need to make it work in IE7 too as we have IE7 in client's compatible browsers list.
Note: the problem is only with focus, text box is turned to editable after clicking. But need second click to keep focus in it. Expecting it to be done on the first click only.
<input name="testId" id="testId" size="25" maxlength="40" tabindex="21" class="width250" readonly="true"/>
$("#testId").click(function(){
$(this).removeAttr("readonly");
$(this).focus();
});