/    Sign up×
Community /Pin to ProfileBookmark

how to get text box on click

for example i create a selection box for different cities.i can’t give all cities in that selection box.so i want put a option “OTHER CITY” so on click on that option i want to get text box and then i have to enter city name in that and then accept it. this my question.

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJan 08.2009 — <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example</title>

<i> </i> &lt;style type="text/css"&gt;
<i> </i> .hidden {display:none}
<i> </i> &lt;/style&gt;

<i> </i> &lt;script type="text/javascript"&gt;

<i> </i> if (document.getElementById) onload = function () {
<i> </i> document.getElementById ('pick').onchange = function () {
<i> </i> document.getElementById ('other').className = this.options[this.selectedIndex].text == 'Other' ? 'seen' : 'hidden';
<i> </i> }
<i> </i> document.getElementById ('other').className = 'hidden';
<i> </i> }

<i> </i> &lt;/script&gt;
<i> </i>&lt;/head&gt;
<i> </i>&lt;body&gt;
<i> </i> &lt;form action=""&gt;
<i> </i> &lt;fieldset&gt;
<i> </i> &lt;legend&gt;Giant says&lt;/legend&gt;
<i> </i> &lt;label&gt;Pick one&lt;select name="pick" id="pick"&gt;
<i> </i> &lt;option&gt;Fee&lt;/option&gt;
<i> </i> &lt;option&gt;Fie&lt;/option&gt;
<i> </i> &lt;option&gt;Foe&lt;/option&gt;
<i> </i> &lt;option&gt;Fum&lt;/option&gt;
<i> </i> &lt;option&gt;Other&lt;/option&gt;
<i> </i> &lt;/select&gt;&lt;/label&gt;
<i> </i> &lt;label id="other"&gt;Other&lt;input name="other"&gt;&lt;/label&gt;
<i> </i> &lt;button type="submit"&gt;Submit&lt;/button&gt;
<i> </i> &lt;/fieldset&gt;
<i> </i> &lt;/form&gt;
<i> </i>&lt;/body&gt;
&lt;/html&gt;
×

Success!

Help @rajasekharbabu 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 5.22,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...