How can I replace 'http://' or 'https://' from a text added with javascript?

I am also interested in regex solutions.

Here is what I made so far:

[JSFIDDLE](https://jsfiddle.net/wLrjtjt3/3/)

HTML:

```
<div class="string"></div>

```

JS:

```
$text = $('.string').text("http://www.text.com");

if ($text.startsWith('http://')) {
    $text.replace('http://','');
}
else if ($text.startsWith('https://')) {
    $text.replace('https://','');
}

```