开发者

Get value of multiple select list values jquery

Im wanting to collect the selected value of a select list, and insert the value into span tag. I am using the msDropdown jquery plugin which skins the select list.

The code below initiates the plugin, but how i would alter it to so that it outputs the value of the selected option to a span tag each time user selects an option?

I know the answer is simple, and I do have some rough skills with jquery, but my 开发者_JAVA百科brain has buckled because ive been coding in PHP for the past week and am finding it hard to remember how to tackle this.

$(document).ready(function() {

        $("#websites2").msDropDown({mainCSS:'dd2'});


})

All help is appreciated, cheers Lea


First add the change listener to your select and then initialize the msDropDown. This works for me on the demo at http://www.marghoobsuleman.com/jquery-image-dropdown.

$('#websites2').change(function() {
    $('#id-span').html($('#websites2').val());
});
$("#websites2").msDropDown({mainCSS:'dd2'});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜