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

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -