I need to remove all url from variable in textarea. But it only remove the first one. Need to removed at all once the button clicked.
var urlDelete = "https://upload.wikimedia.org/wikipedia/commons/a/a0/Google_favicon_2012.jpg";
$('#remove').click(function() {
$('#input').val(
$('#input').val().replace(urlDelete, ''))
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<textarea id="input" style="width:400px; height: 120px">
remove all url from variable: https://upload.wikimedia.org/wikipedia/commons/a/a0/Google_favicon_2012.jpg
this url must be removed: https://upload.wikimedia.org/wikipedia/commons/a/a0/Google_favicon_2012.jpg
must not be effected: http://stackoverflow.com
and http://google.com
again: https://upload.wikimedia.org/wikipedia/commons/a/a0/Google_favicon_2012.jpg
</textarea>
<br/>
<br/>
<button id="remove">remove</button>
How the best way to make all url removed?
Thank you so much for any guide.