(Javascript) Convert plain text links to clickable links

后端 未结 4 1185
离开以前
离开以前 2021-01-06 06:03

Long story short, I have a website made under Wix.com editor, and coding was made possible a few months ago. I have set up a custom comment box, so users can post their comm

4条回答
  •  暖寄归人
    2021-01-06 06:46

    I'm not sure what $w is or if you can really assign the html like that, but i'm guessing this is jquery since the $ most commonly refers to the jquery object.

    Your try was close, it would be..

    $('#text95').html($('#text95').html().replace(/((http:|https:)[^\s]+[\w])/g, '$1'));

    try it..

    $('#text95').html($('#text95').html().replace(/((http:|https:)[^\s]+[\w])/g, '$1'));
    
    
    
    stuff and stuff and http://ww.stuff.com stuff

提交回复
热议问题