javascript - php for loop not sent to jquery -


I am having this problem when I have a link to the loop and I want to link each link through jquery Alert but only the first link is working. What can be the problem?

  & lt; Link rel = 'stylesheet' href = 'css / nook.css' type = 'text / css' media = 'screen, projection' /> & Lt; Script type = "text / javascript" src = "js / jquery-1.10.2.min.js" & gt; & Lt; / Script & gt;  

This is my script

  & lt; Script & gt; $ (Document) .ready (function () {$ ("# click") Click (function (e) {e.preventDefault (); alert ("hi");}}}}) & lt; / Script & gt;  

And this is my loop

  & lt; For php ($ i = 0; $ i & lt; 2; $ i ++) {echo " 

The element's ID must be unique, using the same elements to group the group

  & lt ;? For Php ($ i = 0; $ i & lt; 2; $ i ++) {echo " a & lt; / a & gt; Lt; br & gt; "; }? & Gt;  

then

  & lt; Script & gt; $ (Document) .ready (function () {$ ("click"). Click (function (e) {e.preventDefault (); Alert ("hi");}}}}) & lt; / Script & gt;  

When you use, it will return only the first element that the given ID will be ignored. So in your case the click handler will only enter the first element, click ID


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -