« Back
You are in :
Recent Topics »
Using jQuery »
Why is unbind('click') not working?
Hello,
"onclick" is not realy an event, it's a dom attribute which you can remove with attr('onclick', '')
To use "unbind" function, you have to drop your onclick attribute and use "bind", "click", or better "one" function
- <style type="text/css">
- .mark_print{cursor: pointer;}
- </style>
- <script type="text/javascript">
- $("img.mark_print").one('click', function(){
- $(this).
- attr('src', '../images/icon-tick.png').
- attr('title', 'Printed').
- removeClass('mark_print');
- });
- </script>
- <img alt="47767" title="Mark as printed" class="mark_print" src="../images/icon-printer.png">
Post Actions

