I have implemented a dropdown feature on focus of an <input type='text'>
box in the following manner
http://jsfiddle.net/Newtt/7ffdF/
The issue I am facing is with the positioning of the dropdown box. It currently displaces the content of the container-box
below it. Is there a way to make this text box act like a select
tag without actually using the select tag?
My CSS for the dropdown div includes:
display:none;z-index:200;
To show the dropdown on focus, I use the following jQuery code:
$('#text-box').focus(function(){
$('.dropdown').show();
});
Additionally, I want the dropdown to disappear when the focus is removed from the search box.
In summary, I have two questions:
- About fixing the position of the dropdown
- Enabling toggling of the dropdown visibility on and off focus of the search box
Thank you!