I am setting the focus on a certain input field when loading a page using the following line:
$('#myInputID').focus();
Is there a way that I can undo or remove this focus when hovering over a certain element? (The focus does not have to be reset after leaving this element.)
I couldn't find a function that is the opposite to the above in jQuery or would otherwise work here.
For all textbox :
$(':text').blur()
$(':text').attr("disabled", "disabled");
sets all textbox to disabled mode.
You can do in another way like giving each textbox id. By doing this code weight will be more and performance issue will be there.
So better have $(':text').attr("disabled", "disabled");
approach.
If you have readonly
attribute, blur by itself would not work. Contraption below should do the job.
$('#myInputID').removeAttr('readonly').trigger('blur').attr('readonly','readonly');
Source: Stackoverflow.com