重複の可能性:
jQueryを使用したリンクでクリックイベントを再起動する
チェックボックスをオンにしたときにクリックされているアンカーリンクをティガーすることは可能ですか?以下は私のhtmlとjQueryです
HTML:
<div id="filter-1" class="filter tags">
<ul>
<li class="grey">
<input type="checkbox">
<a title="" href="/collections/mens/grey">Grey</a>
</li>
<li class="all">
<input type="checkbox">
<a title="" href="/collections/mens">All color</a>
</li>
</ul>
</div>
jQuery:
$("input[type='checkbox']").change(function(){
var item=$(this);
if(item.is(":checked"))
{
item.siblings('a').trigger('click');
}
});