How do we execute a function when an element loses focus?

 Posted by Vivek.Ramapuram on 8/2/2014 | Category: CSS 3 Interview questions | Views: 1793 | Points: 40

Here on the text box lose focus, we should create onblur event fires and we should execute callfuncton and we should set a background color for text box to highlight

Enter your name: <input type="text" name="txtName" id="txtName" onblur="CallFunction(" />

<input type="button" id="btn" name="btn" value="Submit" />
<script type="text/javascript">
function CallFunction(id) {
document.getElementById(id).style.background = "blue";

Asked In: While Learning | Alert Moderator 

Comments or Responses

Login to post response