I am able to populate paragraph using script below, but how can I populate input field value using this script? Any idea?
$(function check(){
$(document).ready(function() {
$('#forma').submit(function(e){
e.preventDefault();
$('.qty').each(function(){
if($(this).val() != '0')
{
$('#output').text($('#output').text()+ ' ' + $(this).attr('name') + ' ' + $(this).val()+ ';' );
}
});
});
});
});
$('#someInput').val('some value');?.text()of aninputbecause it doesn't have a "text" to set. It has a "value". It's a subtle semantic difference, but an important one. So to set the value you would use the.val()function.