How can I Strip all regular html tags except , (>

前端 未结 4 566
误落风尘
误落风尘 2020-12-21 02:29

When a user create a message there is a multibox and this multibox is connected to a design panel which lets users change fonts, color, size etc.. When the message is submit

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-21 03:07

    with jQuery you can find all the elements you don't want - then use unwrap to strip the tags

    $('#container').find('*:not(br,a,img)').contents().unwrap()
    

    FIDDLE

提交回复
热议问题