substring/regex to get a src value held in a string

前端 未结 7 1082
花落未央
花落未央 2021-01-02 05:25

I have a string with the value:

var string = \"\'\'
Some plain text
7条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-02 06:19

    You can use jQuery to do this, using the find method, get the src attribute of the image.

    var str = '';
    
    var result = $(str).find('img').eq(0).attr('src');  //  get a image src 
    

提交回复
热议问题