Replace Square Brackets for links on web page

前端 未结 2 493
说谎
说谎 2021-01-27 10:13

I\'m trying to do a parse of html content using jQuery/Javascript. I want to look for words between square brackets and change the whole word for a link.

Example:

2条回答
  •  深忆病人
    2021-01-27 10:38

    $("div").html(function(i, html) {
        return html.replace(/\[\[(.+?)\]\]/g, "$1");
    });
    

    DEMO: http://jsfiddle.net/y4N6e/

提交回复
热议问题