首页 > 网站 > 建站经验 > 正文

jquery使整个div区域可以_点击的方法

2019-11-02 15:48:13
字体:
来源:转载
供稿:网友

   本文实例讲述了jquery使整个div区域可以点击的方法。分享给大家供大家参考。具体分析如下:

  这里实现可以让用户点击整个div区域,这段代码会自动查找div里的链接

  ?

1 2 3 4
文艺网名[www.la240.com/html2017/1/33/]
$(".myBox").click(function(){ window.location=$(this).find("a").attr("href"); return false; });

  Reference HTML:

  ?

1 2 3 4 <div class="myBox"> blah blah blah. <a href="http://google.com">link</a> </div>

  希望本文所述对大家的jQuery程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表