Using javascript/jQuery to get attribute values from an HTML string

前端 未结 4 999
旧时难觅i
旧时难觅i 2021-01-02 09:51

I have an HTML string that contains text and images, e.g.

...

...

I need to

4条回答
  •  庸人自扰
    2021-01-02 10:54

    I normally use the below:

    $(content).attr("src")
    where 
    content = "img src='/somesource/image.jpg'>" //removed < before img for html rendering in this comment
    

提交回复
热议问题