Code :-
<script type="text/javascript">
function get_values()
{
var a = document.getElementById('multiple_values').value;
var array=a.split(",");
var st='';
for(i=0;i<array.length;i++)
{
st=st+" -> "+array[i];
}
//alert(array[2]);
st="Values are "+st;
document.getElementById('display').innerHTML=st;
}
</script>
<select onchange="get_values();" id="multiple_values">
<option value="">
Select
</option>
<option value="586,896,8856">
Numbers
</option>
<option value="Unpossible,pog,youtube">
Characters
</option>
</select>
<div id="display">
</div>
_______________________________________________
More info
Hello
guys, this is unpossible pog and in this tutorial I shall show you
simplest way to apply multiple values on sslect tag that is in
dropdown option.
guys, this is unpossible pog and in this tutorial I shall show you
simplest way to apply multiple values on sslect tag that is in
dropdown option.
First
lets try sending single value, in script tag, create get_value
function, and in select tag, on change event, call that function.
lets try sending single value, in script tag, create get_value
function, and in select tag, on change event, call that function.
The
function is called.
function is called.
So
lets get the single value.
lets get the single value.
Give
an id to select tag, and call that id in getElementById function.
an id to select tag, and call that id in getElementById function.
Store
that in variable a.
that in variable a.
Now
the simplest way is to compress multiple values into one single value
and divide them using special character, in my case it is “comma”.
the simplest way is to compress multiple values into one single value
and divide them using special character, in my case it is “comma”.
And
in javascript function, split them. Give comma in split function.
in javascript function, split them. Give comma in split function.
Array[0]
means the first variable that is in number it is 586, and in
characters it is “unpossible”.
means the first variable that is in number it is 586, and in
characters it is “unpossible”.
If
you want to display all the values, then follow the steps that I am
showing.
you want to display all the values, then follow the steps that I am
showing.
Create
div and give specific id to it.
div and give specific id to it.
Thats
it guys, don’t forget to like share and subscribe.
it guys, don’t forget to like share and subscribe.
And
I see you in the next video.
I see you in the next video.
No comments:
Post a Comment