Currently I have this code for getting multiple weight
<input type="number" name="myWeight" id="1A">
<input type="number" name="myWeight" id="1B">
<input type="number" name="myWeight" id="1C">
This is my current javascript lines
var selWeight = [];
$('input[name="myWeight"]').each(function() {
selWeight.push($(this).val());
});
alert(selWeight);
This current code is working fine and this is the output of this code
But the problem is if the user only enters this
and this is the output
What I only want is to get the text field that is not empty.




if($(this).val() != '') selWeight.push($(this).val());