Click here to Skip to main content
16,012,759 members
Please Sign up or sign in to vote.
3.40/5 (3 votes)
See more:
Iam using onBlur property of textbox to set the list box visible property false
My script is below.But it is not working .If any one help me for this?


XML
<script type="text/javascript">
                function lstFocus(lBox) {
                    debugger;
                   
                    var x = document.getElementById(lBox);
                    x.setAttribute("visible", "hidden");
                }

   </script>
Posted
Updated 8-Aug-13 22:58pm
v3
Comments
Sampath Lokuge 9-Aug-13 4:55am    
Plz remove above code and paste your code again.Above code is not properly formatted.

You can simply do that is as below.

Live Demo :

http://jsfiddle.net/SWKSf/1/[^]

Code

XML
<input type="text" id="fname" onblur="myFunction()">

<select id="lstBox">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>


<script>
function myFunction()
{
var x=document.getElementById("lstBox");
x.style.display = 'none';
}
</script>


I hope this will help to you.
 
Share this answer
 
HI,

You can use the following line:
x.css('visibility', 'visible');


or

x.style.visibility = "hidden";


Thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900