2017-05-20 35 views

回答

0

添加其他然後form-control所有文本框的一類,因爲這個類由引導和jQuery中獲得的價值,如:

<input type=text name="text_quest" class="form-control userInput"> 

$('.userInput').each(function(){ 
    console.log($(this).val()); 
}); 

這將打印在控制檯每個文本框的值。您也可以將值推入數組中並使用該數組。

0

使用請求表單,您可以在您的帖子中獲得文本框的值。

string [] textboxesvalue = Request.Form.GetValues(「text_quest」);

0

var textboxElements = document.getElementsByClassName("form-control")將返回所有文本框元素的類似數組的對象。您可以迭代該對象屬性來訪問每個文本框的值,如下所示:

[].forEach.call(textboxElements, function (textboxElement) { 
    console.log(textboxElement.value); 
}); 
相關問題