Trying to set a parameter on a hidden field on click of submit button.
$('.delete').on('click', function() {
$('#id').val('1000');
});
This is the hidden field:
<input type="hidden" name="itemId" id="id" />
And this is one of my submit buttons:
<input type="submit" value="Delete item" class="delete" />
However at the server the itemId field is empty.
Try to do it by using Jquery .attr() function :
Change:
$('.delete').on('click', function() {
$('#id').val('1000');
});
To:
$('.delete').click(function() {
$('#id').attr('value','1000');
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.