Hello, I'm following instructions on video "16 Final Reddit clone improvements by Massimo" and I'm having problems calling jquery on button click:
Here is my code: {{for post in row:}} <div class="alert alert-info"> <table> <tr data-id="{{=post.id}}"> <td><button data-direction="up">+</button></td> <td><span class="votes">{{=post.votes}}</span></td> <td><button data-direction="down">-</button></td> <td><strong> {{=A(post.title, _href=post.url) if post.url else post.title}}</strong><br/></td> </tr> <tr><td colspan = "3"></td> <td>{{=A('comments', _href=URL('view_post', args = post.id))}}</td> </tr> </table> </div> {{pass}} <script> function do_ajax_vote(t,direction) { alert('clicked'); } jQuery(function(){ jQuery('[data-direction=plus]').click(function() {do_ajax_vote(this, 'up');}); jQuery('[data-direction=minus]').click(function() {do_ajax_vote(this, 'down');}); }); </script> When I click the buttons, nothing happens, no popup. My pop-ups are not blocked. I'm not sure what I'm doing wrong... Thanks in advance! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.