When I user click on the button remove word and as enter 2 in the input box it should remove it from the element id="list"
<input type="text" id="word"><input type="button" value="remove word">
<span id="list">1,2,3</span>
I did the following on the click event:
var text = $('.word').val();
$('#list').html($('#list').html().replace(/text/ig, ""));
I understand it looks for the string text and not the var. So how can I change the syntax to make it search for the var.