[英]Triggering dayClick of fullCalendar with agendaDay view
考虑这个HTML
<tr class="fc-slot120 ">
<th class="fc-agenda-axis fc-widget-header">4PM</th>
<td class="fc-widget-content">
<div style="position: relative;"></div>
</td>
</tr>
单击td.fc-widet-content
,将按预期方式调用dayClick事件。 我想这个功能扩展到了th
有时间,以便更容易超售。 确实会调用此代码,但不会触发dayClick。
$('.fc-agenda-axis.fc-widget-header').click(function() {
$(this).find('td.fc-widget-content').trigger('click');
});
任何想法如何触发内容td
上的dayClick
事件? 如果我直接单击td.fc-widget-content
元素,则会按预期触发dayClick。
尝试使用兄弟姐妹
jQuery(document).ready(function($) { $('.fc-widget-header').click(function() { $(this).siblings('.fc-widget-content').trigger('click'); }); $('.fc-widget-content').on('click', function() { console.log('click') alert('.fc-widget-content clicked') }) });
.fc-widget-header { height: 100px; width: 100px; background-color: red; color:white } .fc-widget-content { height: 100px; width: 100px; background-color: blue; color: white; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <table> <tr class="fc-slot120"> <th class="fc-agenda-axis fc-widget-header">4PM</th> <td class="fc-widget-content"> testt <div style="position: relative;"></div> </td> </tr> </table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.