スポンサーリンク

リンクのaタグを要素全体に聞かせるjQuery

jQuery

jQueryを読み込んで下記を追加。

.boxというclass名をつければその要素全体にリンク要素が効きます。

<script type="text/javascript">
$(function(){
	$(".box").click(function(){
    	window.location=$(this).find("a").attr("href");
    	return false;
    });
});
</script>

 

タイトルとURLをコピーしました