php - catching nested button clicks -


I have php code on a page that generates a series of buttons, such as: (in a loop)

  echo "  

Then I have a junkie that catches those clicks, and also creates a button:

  $ ('input: button'). Click (function () {$ (This) .next ("span") attachment ('You clicked this button!'); $ (This) .next ("span"). Attachment ('& lt; input type = \ "Button \" event = '+ EventID +' id = \ "submitbutton \" value = \ "send \" /> '); $ (' # submitbutton ') (function () {}}   

My purpose is to capture all the button clicks on the page correctly. (Any order on which they are not clicked, the PHP generated buttons can be used in the same way Should behave, the secondary button is a different one Should behave in a manner)

In the code given above, it works correctly in advance, lets you click on the button and create a secondary button for each. But once When you click on a secondary button, it starts behaving all odd. Then, click any code for #submitbutton.

Do I have to use a class here? If this is the case, one example would be good . What

You do not need to attach button, then select it. You can create an input element in a jQuery object and then bind to an event on that object such as:

  $ ('input: button'). Click (function () {var span = $ (this) .next ("span"); span.append ('you clicked this button!'); $ ('& Lt; input type = \ "button \" Event = '+ eventID +' value = \ "send \" / & gt;) .appendTo (span). Click (function () {// do stuff here});});    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -