0
Je suis tryig à lire dans les zones de texte dans un tableau. Comment puis-je le faire? J'ai le code suivant, mais ça ne marche pas.Comment lire les valeurs d'une table dans un texte?
<table id="dataTable">
<thead>
<tr>
<th>Name</th>
<th>Value</th>
</tr>
</thead>
<tr>
<td>
<input id="Name" type="text" value = "test1" />
</td>
<td>
<input type="text" value = "test11" />
</td>
<td>
<input type="button" value = "button11" />
</td>
</tr>
</table>
Mon script actuel est comme suit:
$(document).ready(function() {
$("#Click").click(function() {
var i = 0;
var inputs = new Array();
$("#dataTable tr").find("input").each(function() {
alert($(this.value));
alert($(this.id));
inputs[i] = [this.id, this.value];
i++;
});
var columnsCount = $("#dataTable").find("th").length;
alert($(columnsCount));
});
});
<input type="button" id= "Click" value="Click" />