📌  相关文章
📜  hi;ight word in textarea javascript代码示例

📅  最后修改于: 2022-03-11 15:02:46.109000             🧑  作者: Mango

代码示例1
$(function(){
  $("#search").click(function(){
    var area   = $('#test');
    var findWord = "rhoncus";
    var index = area.val().indexOf(findWord);
    area.focus().prop({'selectionStart': index, 'selectionEnd': index+findWord.length})          
  })
})