I have a table cell and what I want is that if the user clicks on the table cell a div collapses (div is in another table cell).
$(function slideDown(id) { $("getdiv"+id).fadeIn(); });
The table row (hover function):
<tr class="odd" id="div96" onhover="slideDown(96)"><td>ZZZn ZZZ</td></tr>
The table cell (needs to fade in/slide down):
<tr><td id="getdiv95" class="divinside" style="display: none;">Text</td></tr>
I'm sorry for my poor English.
You are doubling up the 'div' part.
var name = $(this).attr('id');
$("#" + name).slideDown();
The way you have it written now it would look like
$("#divdiv1")...
Instead of
$("#div1")...
Also, wrap all this in a $(document).ready(function(){}); so that it triggers the click binding after all the tr elements have loaded.
向下滑动是一个函数,必须调用它才能运行它:
$("#div" + name).slideDown();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.