Switch statement in jQuery not working -


i writing little jquery function changes value of form field when user changes value of drop down list.

my function changing data works reason not "switching". can shed light?

here code:

$('#linktype').change(function(){ var thistype = $('#linktype').val(); switch(thistype){     case 'facebook':      changeurl("http://facebook.com/");     break;     case 'twitter':     changeurl("http://twitter.com/");     break; } }); function changeurl(value){ $('input[id="link"]').val(value) ;   }; 

facebook should string literal 'facebook'

$('#linktype').change(function(){ var thistype = $('#linktype').val();    switch(thistype){    case 'facebook': 

else need have variable called facebook string value

var facebook = 'facebook' $('#linktype').change(function(){ var thistype = $('#linktype').val();    switch(thistype){    case 'facebook': 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -