var hdcval = $("#hdelsecount").val(); hdcval += icount + ","; $("#hdelsecount").val(hdcval);
Appends a value to a hidden field. .
Original is 0
icount is the number passed in
think so
$("#hdelsecount").val(icount+",");
I thought I could repeatedly append values, such as 1, 2, 3, 4, but the val() method is overridden. Instead of appending characters to the value. . Which method is additional? ?
answer:
$("#hdelsecount").val($("#hdelsecount").val() + icount+",")
…
The post jquery how to add val() values first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/9128
This site is for inclusion only, and the copyright belongs to the original author.