How can I blur a div where contentEditable=true?

前端 未结 4 903
逝去的感伤
逝去的感伤 2021-01-11 08:57

How can I blur/focusout a div where contentEditable=true? I have attempted $(elm).blur() and $(elm).attr(\'contentEditable\', false);

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-11 10:02

    Appending to all answers, when using something like

    $(".editable").blur()
    

    think about blurring only focused, like

    $(".editable:focus").blur()
    

    If not you can get into nice probs sometimes

提交回复
热议问题