I am beginner and wanna to ask u guys! I have a code but it doesn work. I want to collect all data in array after that this array will be sorted by the value and output the minimum value on the web page. I create a code to collect input values from user but dont know what to do next. Could u help me? (the output should look like this: your math score is low (3) u should improve this section) Please guys!
<script>
var myItems = []
function add(e) {
var obj = {};
$('#addItem input[type="text"]')
.each(function() {
obj[this.name] = this.value;
});
myItems.push(obj);
}
function test(e) {
alert(JSON.stringify(myItems));
}
$(document).ready(function() {
$('#add').click(add);
$('#test').click(test);
});
</script>
<form id="addItem">
<table id="tblSearchTally">
<tr>
<td>Biology:<input type= "text" value ="1" name="plank" id="plank"></td>
</tr>
<tr>
<td>Chemistry:<input type= "text" value ="4" name="width" id="width"></td> </tr>
<tr>
<td>Physics:<input type= "text" value ="6" name="length" id="length"></td> </tr>
<tr>
<td>Math:<input type= "text" value ="4" name="thickness" id="thickness"></td>
</tr>
</table>
<p><in
Aucun commentaire:
Enregistrer un commentaire