i have a page which lists in a table, information about movies. each row
displays the movie title, release date, running time...
what i would like to have happen is when a row is clicked, i want to add a
row beneath the clicked row which will display the movie description and a
thumbnail image of the cover art. the content for this new TR should be
loaded via ajax from another page.
then when the user clicks the original table row again, it should either:
a) remove the tr we just added.
b) hide the tr we just loaded
i am trying to do this but have been unsuccessful. you can see the page i
am talking about at
http://bdee.no-ip.com:9000/asp/index.asphttp://bdee.no-ip.com:9000/asp/index.asp heres how i was tryign to do it:
the table row containg the movie title and other info looks like this:
<tr id="414" class="listing" >
<td>
# Invincible
</td>
<td>2006</td>
<td>105</td>
<td> View Trailer </td>
</tr>
and up above in the head of my document i have the following:
//show/hide description row on click
$("tr.listing").click(function(){
var myID = $(this).attr("id");
$(this).after("<tr><td colspan='4' class='description'></td></tr>");
$(this).next(".description").load("movieDetailsAjax.asp?movie="+myID);
$(this).next(".description").toggle();
});
so the idea is that whenever you click a row with a class of "listing" the
following will happen:
set a variable congaing the movie id number
after the current row, insert a row with one cell spanning all 4 columns
then starting with the current row, find the next row with a class of
"description" (the row we just created) and load the content from the ajax
file (the html for the movie description and the thumbnail image)
then starting with the current row, find the next row with a class of
"description" (the row we just created) and toggle it. that way when you
click on the row again, it will close this cell.
I know this code doesn't work but i just cant figure out how to write the
code for what i want to do.
can anyone help guide me along here?
--
View this message in context:
http://www.nabble.com/onclick---toggle-the-creation-of-a-TR--tf3230589.html#a8975893Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/