How can I detect onclick() or similar for individual characters in a text?

前端 未结 6 2168
你的背包
你的背包 2020-12-20 21:49

I\'m new to Javascript and would like to modify a text string by clicking on individual characters. The string is: 0000 0000 0000 0000 representing a binary num

6条回答
  •  不知归路
    2020-12-20 22:12

    Put each 0 into a span and register an eventhandler on the whole paragraph, in order to use delegation. Use Event.target property to change the text of the span you clicked on in the event handler.

提交回复
热议问题