JQuery – substring some keyword
March 21st, 2012
substring some keyword
var keyword = ‘abc’;
var index = ($(“#content”).val().indexOf(keyword));
if(index != -1){
var pre = $(“#content”).val().substring(0, index);
var pos = $(“#content”).val().substring(index+keyword.length);
$(“#content”).val(pre+pos);
}