Detect click on the inner text of the element without wrapping the text in a second element

后端 未结 5 743
星月不相逢
星月不相逢 2020-12-19 21:07

I have a Div which is as big as half of my page using CSS:

CLICK ON THIS TEXT

I am trying to wr

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 21:25

    If you want to go straight through HTML, you can use

    and then simply apply the function afterwards in JS:

    function myFunction(){
        //...
    }
    

    EDIT: sorry, if you want the text to be affected, put in

    around the text or ie.

    TEXT

提交回复
热议问题