Selecting text in an element (akin to highlighting with your mouse)

后端 未结 16 1616
孤街浪徒
孤街浪徒 2020-11-21 05:58

I would like to have users click a link, then it selects the HTML text in another element (not an input).

By \"select\" I mean the same way you would select

16条回答
  •  一生所求
    2020-11-21 06:13

    lepe - That works great for me thanks! I put your code in a plugin file, then used it in conjunction with an each statement so you can have multiple pre tags and multiple "Select all" links on one page and it picks out the correct pre to highlight:

    
    
    
                                     
                  
提交回复
热议问题