jQuery if else and selected value from select tag -
why can't value selected input, doing wrong?
if($('#target option:selected').text() == "add") $("#add").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "exit") $("#exit").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "refuse") $("#refuse").show(selectedeffect, options, 500, callback ); else alert('test');
var target = $('#target option:selected').val(); if(target == "add") $("#add").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "exit") $("#exit").show(selectedeffect, options, 500, callback ); else if ($('#target option:selected').text() == "refuse") $("#refuse").show(selectedeffect, options, 500, callback ); else alert('test');
check out here http://api.jquery.com/val/
Comments
Post a Comment