![](/img/trans.png)
[英]How to get selected value from a dropdown after it has been disabled after a selection
[英]Trying to get the text value of a field that has been updated by a dropdown selection
(下面是JS Fiddle的完整代碼)
我正在從一個下拉列表中選擇一個值,然后基於選擇將使用值更新下一個表“ td”。 然后,我遍歷表'tr'以獲取“;” 所有值的分隔列表
在我的小提琴示例中,我將其簡化為2列,如果您從下拉列表中選擇“ 1”,則下一個字段將更新為10,然后下一行更新,相同
我的目標是獲取表中值的列表
For Example 1;10
2;8
出於某種原因,我遍歷該表:“獲取數據按鈕啟動循環”)
$(this).find("td").filter(':visible').each(function (index) {
if (index === 1) {
if ($(this).find("span").val() != undefined) {
values += $(this).find("span").val() + ";";
}
if ($(this).find("text").val() != undefined) {
values += $(this).find("text").val() + ";";
}
if ($(this).find("label").text() != undefined) {
values += $(this).find("label").text() + ";";
}
if ($(this).find("select option:selected").text() != "") {
values += $(this).find("select option:selected").text() + ";";
}
}
});
但是,無論我使用.text(),val(),inner還是externalHTML,它始終是“”
謝謝
不知道確切的目的是什么,但是我需要此解決方案的輸出:
if (index === 0)
{
if ($(this).find("span").val()) {
values += $(this).find("span").val() + ";";
....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.