Javascript examples for jQuery:Mouse Event
JQuery setting onclick attr of another element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#a1').click(function() {//from ww w .j a v a 2 s . co m $("#a2").off("click"); $("#a2").click(function() { prompt('Text:','foo'); }); }); }); </script> </head> <body> <a id="a1">test1</a> <a id="a2">test2</a> </body> </html>