Senior & Expert RoR Developers Discussion Forum by Nyros Technologies

HIRE Ruby on Rails Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

Get all the option in a selectbox using Javascript

 
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Integrating AJAX & RJS and JQuery in ruby on rails applications (Ajaxified rails programming)
View previous topic :: View next topic  
Author Message
venkatadapa



Joined: 30 Nov 2009
Posts: 4

PostPosted: Wed Dec 30, 2009 5:39 am    Post subject: Get all the option in a selectbox using Javascript Reply with quote

<html>
<head>
<script type="text/javascript">
function getOptions()
{
var x=document.getElementById("mySelect");
txt="All options: "
for (i=0;i<x.length;i++)
{
txt=txt + "\n" + x.options[i].text;
}
alert(txt);
}
</script>
Hi friends,
Below is the javascript soruce code for getting all the options in a selectbox.
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
<option>Apple</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Banana</option>
</select>
<br /><br />
<input type="button" onclick="getOptions()" value="Output all options">
</form>
</body>
</html>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert RoR Developers Discussion Forum by Nyros Technologies Index -> Integrating AJAX & RJS and JQuery in ruby on rails applications (Ajaxified rails programming)
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts Built in classes in ruby
0 ktulasi 4 Thu Mar 11, 2010 1:09 pm
ktulasi View latest post
No new posts User defined classes and types of variables.
2 swaminadhan 30 Wed Mar 10, 2010 4:40 am
swaminadhan View latest post
No new posts Background & Introduction of ruby
0 Divya 34 Mon Mar 08, 2010 12:59 pm
Divya View latest post
No new posts i have lost the data in schema.rb file in rails application
0 Raja 43 Thu Mar 04, 2010 4:46 am
Raja View latest post
No new posts AlertPay
0 Raghu 30 Mon Mar 01, 2010 11:36 am
Raghu View latest post
No new posts have a problem while working with facebooker plugin
1 krishnakanth 35 Mon Mar 01, 2010 9:31 am
sharma I View latest post
No new posts Having issues while trying to run the application
1 sharma I 37 Mon Mar 01, 2010 8:56 am
swaminadhan View latest post
No new posts getting twitter tweets using twitter gem
0 sharma I 25 Mon Mar 01, 2010 8:21 am
sharma I View latest post
No new posts JavaScript functionality with Event handling class
0 umamahesh_nyros 23 Mon Mar 01, 2010 7:25 am
umamahesh_nyros View latest post
No new posts Differences between form_for and form_tag in rails
0 sharma I 47 Mon Mar 01, 2010 7:19 am
sharma I View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More