开发者

when dropdown selected their details to be shown in popup how to do that?

Here is my scenario,

IN my page i have a charity dropdown box,when user select any o开发者_JAVA百科ne of the dropdown ,the charity details should be shown in popup box,how to do that???


You should use jQuery to handle the event "onchange" and then complete the other inputs with data retrieved maybe after an Ajax request ?

Here is some kind of code you could use :

HTML Select input :

<select id="charity">
<option id="idtest">test</option>
<option id="idtest2">test2</option>
<option id="idtest3">test3</option>
<option id="idtest4">test4</option>
</select>

Javascript with jQuery :

$(function() {
$("#charity").change(function() {
var selectedOption ID = $("#charity option:selected").attr("id");
// Here is your ajax with jQuery too. Use the var "selectedOption" to know which option is selected
});
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜