去评论
推扬网

李沐宸:jquery如何获取select选中的值

admin
2020/08/12 16:11:36

刘若惜的回答:

1、设置value为pxx的项选中 $(".selector").val("pxx"); 2、设置text为pxx的项选中 $(".selector").find("option[text='pxx']").attr("selected",true);

玻璃碎的很好听.的回答:

1.你的option中没有设置value,取不到值。如果设置了,$("#22").val() 2.要取到fdsfds这个值,用$("#22").html()