search

Home  >  Q&A  >  body text

javascript - Can it be written like this?

$("#team .title" || "#team .title1").css("opacity","1");
or
$("#team .title" && "# team .title1").css("opacity","1");
Can it be written like this?

高洛峰高洛峰2835 days ago618

reply all(3)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-19 10:14:00

    There is an expression inside, "#team .title" || "#team .title1" "#team .title" && "#team .title1"因为字符串恒为真,所以两个分别永远都是$("#team .title") $("#team .title1")

    reply
    0
  • 为情所困

    为情所困2017-05-19 10:14:00

    You can’t write like this

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-19 10:14:00

    "#team .title" || "#team .title1" = true
    "#team .title" && "#team .title1" = false

    Bold guess, $(true) $("falss") is obviously meaningless. If you don't know, just write some tests. It's really lazy.

    reply
    0
  • Cancelreply