php - creating span IDs on the fly for later use in jquery -


I have some PHP code that runs a loop, a button and a span exits, every time it Loop is like this:

(Loop inside)

  echo "& lt; span id = \" sendbutton \ "& gt; & lt; input type = \ "Button \" event = '$ eventID' id = \ "sends \" value = \ "send a family member" /> gt;  "; Echo "& lt; span id = \" names \ "& gt; & lt; / span & gt;";   

Later in my code, I have jquery which catches one of the button clicks and codes, then writes back. What I want to do is, immediately after clicking that button, click on the button that was clicked.

  $ ('# name'). Enclosed ('hey! This button was that you clicked');   

Obviously, in my example, the way I want it does not work much. Each loop creates a span with an ID of names, and so when I click any button, it adds to the highest duration I can easily enter $ eventID as a span id I can use it, but I do not know how it is correctly referenced in my javascript.

How could I add it to the button Clicked? $ (this) Maybe? I just do not know how to use it.

Edit, and info:

My click code looks like this:

  $ ('Input: button') Click (function () {...}   

Even more information:

I should have asked more clearly. Can make my span ID unique . I've just set it to $ eventID but how do I tell it jquery?

You do not have an element with duplicate ID Convert your ID to classes and try it.

  $ ("input.sendsomeone"). ($ (This) .next ("span") .html ('hey! It That was the button you clicked! '));    

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? -