The problem is that if you press the button (1) another button appears (2), and when you press the button (1) again, buttons (2) appear next to the button (2), and only one button appears (2 ) and was not duplicated.

$(html).appendTo('#body'); $('#knopka_1').click(function () { form_i(); }) 

That is, when you press the button (1), the function is called where the button (2) is registered.

PS This is javascript.

  • Throw off the code completely. It is possible that in your form_i () function you add the handler to # knopka_1 - lampa

1 answer 1

Disable the handler after the event is triggered. For example:

 $('#knopka_1').click(function () { $(this).unbind('click'); }); 
  • one
    This is not a solution to the problem, but only a crutch for her. - lampa 8:50
  • For the voiced problem - this is the solution. - Indifferent
  • 2
    Why not go further? ))) There is no tilled field for crutches. Here is another solution: $ ('# knopka_1'). One ('click', function () {form_i ();}); - Deonis