/    Sign up×
Community /Pin to ProfileBookmark

Bootstrap drop down or any drop down

Is there a way so that when the pages loads, a specified drop down’s default behavior is to display, without being clicked? Then when the menu item is clicked it closes?

My guess is that it is a js behavior but it might be some kind of bootstrap setting as well. I have been looking and can’t find anything yet.

Thanks,

Mark

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERMar 21.2016 — Are you asking for the drop down menu to be displayed as if the user had clicked on the element BEFORE the user clicks on it? Sort of defeats the purpose of the real estate savings element. But you can do it by setting the size attribute.

If you want a pre-selected option to be displayed when the user enters the page, just set the <option> tag to <option selected> for single choice displays.

For example:
[code=php]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />

<title> HTML5 page </title>

</head>
<body>

<select size="6" onchange="this.size='1'">
<option value=""> Select </option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3" selected>Three</option>
<option value="4">Four</option>
<option value="5">Five</option>
</select>

</body>
</html>
[/code]
×

Success!

Help @dmarkwa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...