回答(30)
2 years ago
在兄弟情况下
Select Client name....
abc
/*jQuery*/
$(this).siblings('select').children(':selected').text()
2 years ago
var someName = "Test";
$("#").each(function () {
$('option', this).each(function () {
if ($(this).text().toLowerCase() == someName) {
$(this).attr('selected', 'selected')
};
});
});
这将有助于您获得正确的方向 . 如果您需要进一步的帮助,请通过以上代码进行全面测试 .
2 years ago
对于所选项目的文本,请使用:
$('select[name="thegivenname"] option:selected').text();
对于所选项目的值,请使用:
$('select[name="thegivenname"] option:selected').val();
2 years ago
在下拉列表中选择文本和选定的值/在jQuery中选择更改事件
$("#yourdropdownid").change(function() {
console.log($("option:selected", this).text()); //text
console.log($(this).val()); //value
})
2 years ago
$(function () {
alert('.val() = ' + $('#selectnumber').val() + ' AND html() = ' &#