I am trying to hide a table row with jQuery instead of js as in this question . This is the script I entered in the header:
self.response.out.write(""" <html> <head> <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" /> <title>User Admin Page</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> <script> $(document).ready(function() { $("#false").click(function() { $("#hide").hide("slow"); }); }); </script> <body> """)
And here is the html:
... <tr class="hide"> <td> ... <a class="false" href="/useradminpage?main_id=%s&display=false"><span class="small">(hide)</span></a> </td> </tr> </div> ...
This does not work. And this question is the same as this one, but I canβt do my job. What am I doing wrong?
Update
Edited code according to answers. But this still does not work, although it works in jsfiddle:
<html><head> <link type="text/css" rel="stylesheet" href="/stylesheets/main.css" /> <title>User Admin Page</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> <script> $(document).ready(function() { $("a.false").click(function(e) { $(".hide").hide("slow"); e.preventDefault(); }); }); </script> </head> <body> ...
Update
Closing </script> missing in the CDN call; but now the whole table is hidden; I am adding this section of the table. Thanks again for the answers:
self.response.out.write("""<table class="mytable"> <tr class="head"> <th width="80%">links</th><th>edit tags</th> </tr> """) query = Main.all() query.filter("owner", user) query.filter("display", True) query.order("-date") cursor = self.request.get("cursor") if cursor: query.with_cursor(cursor) e = query.fetch(100) cursor = query.cursor() for item in e: main_id = item.key().id() self.response.out.write(""" <tr class="hide"> <td><a href="%s" target="_blank">%s</a><span class=small> (%s) </span><br /> <span class=small>%s</span> <a href="/edit?main_id=%s"><span class="small">(edit)</span></a> <a class="false" href="/useradminpage?main_id=%s&display=false"><span class="small">(hide)</span></a> <a href="/comment?main_id=%s"><span class="small">(comments)</span></a></td> <td><a href="/tc?url=%s&main_id=%s&user_tag_list=%s" title="edit tags">%s</a> </td> </tr> """ % tuple([item.url, item.title, urlparse(item.url).netloc, f1.truncate_at_space(item.pitch), main_id, main_id, main_id, item.url, main_id, (", ".join(item.tag_list)), (", ".join(item.tag_list)),])) self.response.out.write("""</tbody></table>""")
source share