Activate Javascript when click link PHP -


I have a link in HTML / PHP, and on click event, I have to implement JavaScript / Jquery code / code:

PHP / HTML:

  echo "& lt; a id = 'codeelinka' class = 'linknew' href = '' & gt; $ kd_mrp & lt; / A & gt; ";   

Javascript:

  & lt; script type = "text / javascript" & gt; $ ('# Codelink') Click (function () {var value = "bbbb"; Alert ("AAAAA"); $ ('# codelink'). FadeOut ();}); & Lt; / Script & gt;   

How do I enable the script?

e.g.

  echo "  

You need to stop the anchor tag default action. You can also do this like

  $ ('# kodelinka'). Click (function (e) {E.preventDefault ();   

Make your script work in your page

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -