This is my code
$(function(){
$('#dropdown_name').change(function(){
var V = $('#dropdown_name').val();
var T = $('#dropdown_name :selected').text();
});
});
I want to send V and T's value below function
function xyz()
{
a = V;
b = T;
alert(a);
alert(b);
}
In Function xyz, I have to call many function so I don't want, it take as parameter of xyz function. So how can I get data in another way when I will select a dropdown then it will display alert(a and b) that value and text of dropdown.
How to solve it, please any suggestion.
You can use global variables instead:
function xyz()
{
a = window.V;
b = window.T;
alert(a);
alert(b);
}
You will call the function like so:
$(function(){
$('#dropdown_name').change(function(){
window.V = $('#dropdown_name').val();
window.T = $('#dropdown_name :selected').text();
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With