我有以下小提琴
如何为所有上述类my-collaspible
触发click事件<div data-role="content" class="data">
<div class="my-collaspible" data-inset="false" data-role="collapsible">
<h3>Top Stories</h3>
<p>4 Britons Who Sought to Get to Syria Arrested on Return to UK</p>
<p>SpaceX Rocket Blasts Off, Then Lands Too Hard on Ocean Barge</p>
<p>CCTVs in Buses in Kolkata to Make Journey Safer</p>
<p>Report Fire, Accidents in Goa Via App</p>
</div>
<div class="my-collaspible" data-inset="false" data-role="collapsible">
<h3>Sports Headlines</h3>
<p>West Indies hold firm after early England wickets</p>
<p>Rajasthan Royals face Mumbai Indians</p>
<p>One week to go, no IPL chairman as yet</p>
</div>
<div class="my-collaspible" data-inset="false" data-role="collapsible">
<h3>Movies</h3>
<p>MOVIE 1----------</p>
<p>MOVIE 2----------</p>
<p>MOVIE 3----------</p>
</div>
</div>
javascript
$(document).ready(function () {
$('.my-collaspible').on('collapsibleexpand', function () {
alert('ssss');
});
});
答案 0 :(得分:0)
只需触发点击h3
:
$('.my-collaspible h3').click();
如果您的意思是“上一级.my-collaspible
”,而不是“上级my-collaspible”,那么这可能是您想要的:
$(this).prev('.my-collaspible').each(function(){
$(this).children('h3').click()
});
答案 1 :(得分:0)
如何动态触发所有data-role =“collapsible”present
的可折叠事件
$("[data-role='collapsible']").collapsible( "collapse" );
如何为所有上述类my-collaspible
触发click事件
为什么要伪造click
事件?