开发者

Input box appears if dropdown "Other" is selected?

Here is my final code:

<scri开发者_如何学Gopt type="text/javascript">
jQuery(function() {
    jQuery("#company").change(function() {
        var val = jQuery(this).val();
        if(val == 'other') {
            jQuery('input[name="other"]').fadeIn('slow');
        } else {
            jQuery('input[name="other"]').fadeOut('slow')();
        }
    });
});
</script>


$(function() {
    $("#dropdown").change(function() {
        var val = $(this).val();
        if(val == 'other') {
            $('input[name="other"]').show();
        } else {
            $('input[name="other"]').hide();
        }
    }).change();
});

Updated. as box9 suggested, since you want the function to trigger on page load.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜