[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

JavaScript/jQuery: Open Select Options upon Trigger

Posted on 2013-05-23
3
Medium Priority
?
1,274 Views
Last Modified: 2013-06-03
Is it possible to open the select options with jQuery?

This does NOT work:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){

 $('#openSSS').click(function(){
  $('#sss').click();
 });

});

</script>
</head>
<body>

<select name="Choose_One" id="sss"> 
<option value="a">Option 1</option> 
<option value="b">Option 2</option> 
<option value="c">Option 3</option> 
<option value="d">Option 4</option> 
<option value="e">Option 5</option> 
</select> 

<input type="button" value="Click to open the select" id="openSSS" />

</body>
</html>

Open in new window

0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39191296
Why not? You have make just a small mistake see

<script type="text/javascript">
$(document).ready(function(){

 $('#openSSS').click(function(){
  var selval=$('#sss').val();
  alert(selval);
 });

});

</script>

Open in new window

0
 
LVL 16

Author Comment

by:hankknight
ID: 39191513
That solution is useless.  I want the options to slide down when you click on the button.  I do not need an alert!
0
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 2000 total points
ID: 39191525
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question