I have jquery code that runs everytime everytime I click on my button but I only want it do do the stuff inside the click function once.. Beacuse otherwise my jquery code will duplicate values in my tbody td.
Here is my jquery code:
$(function () {
$('#next-step').click(function () {
$('#S').append($('#SubjectTypeName option:selected').text());
$('#T').append($('#TeamName option:selected').text());
$('#C').append($('#ConsultantName option:selected').text());
$('#K').append($('#company option:selected').text());
$('#KP').append($('#ContactPerson').val());
$('#P').append($('#date').val());
});
});
And here is the jsfiddle: http://jsfiddle.net/82U2W/
Any help is appreciated.
Thanks in advance!
I am not sure if I understood correctly, try
.oneif you want to execute the handler only onceDEMO
Or perhaps you want the value to be copied over instead of appending then try like below,
DEMO