How to set jquery global value -


i have select box as

<select id='selectboxid'>   <option value="">select id</option>   <option value="actor">actor</option>   <option value="child artist">child artist</option>   <option value="">musician</option> </select> 

my jquery code

$(function() {    var option = 80;    $("#selectboxid").change(function() {         option = 17;    }); alert(option); }) 

my requirement when select option option variable value should 17 .please advise how do.

move global variable outside of function

var option = 80; $(function() {       $("#selectboxid").change(function() {         option = 17;        alert(option);   });     }) 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -