jQuery & CSS - Remove/Add display:none

前端 未结 13 2330
遥遥无期
遥遥无期 2020-12-12 12:37

I have a div with this class :

.news{
  width:710px; 
  float:left;
  border-bottom:1px #000000 solid;
  font-weight:bold;
  display:none;
}
<
13条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 12:58

    For some reason, toggle didn't work for me, and I received the error uncaught type error toggle is not a function when inspecting the element in browser. So I used the following code and it started working for me.

    $(".trigger").click(function () {
        $('.news').attr('style', 'display:none');
    })
    

    Used jquery script file jquery-2.1.3.min.js.

提交回复
热议问题