Using开发者_如何学运维 jquery, how would I make a SELECT menu display itself without actually clicking on it?
I tried sending a click() event (in Safari and Firefox) but no luck.
$('#myselectmenu').click();
Also tried focus() and select() (and various combinations of the three).
Any ideas?
Thanks!
I don't think this is possible.
You could use a custom drop-down list.
You always have the option of coding your own function to mimic a "select" menu
Hmmm, onMouseover? But then how do you get it to do the drop down? Feels like there should be some way to invoke that. Never tried it before.
SELECT component is a component to stay away from. Implement you own and, then try mouseenter() and mouseleave() events.
I may be mis understanding but here goes... Your select menu is hidden, and any click you want it to display?
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
</head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('jquery', '1');
</script>
<script type="text/javascript">
$(function(){
$('select').hide();
$(document).click(function(){
$('select').show();
});
});//END Doc Ready
</script>
<body>
<select>
<option>blah</option>
</select>
</body>
</html>
Then I realized you want the DDM to show up so i tried this ... and it did not work. Maybe this gives you an idea?
$(function(){
$('select').bind('blur', function() {
$(this).blur();
});
$(document).click(function(){
$('select option').trigger('blur');
});
});//END Doc Ready
精彩评论