jQuery String Replace in TextArea

前端 未结 4 761
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-23 22:39

I\'m trying to do a string replace in a textarea after the user has entered their content and nothing I\'ve tried is working. Any help would be greatly appreciated. This is wher

4条回答
  •  佛祖请我去吃肉
    2021-01-23 23:13

    jsfiddle

            $("#field_id_29").bind("change keyup input",function(){    
                this.value= this.value.replace(/www-source/g,"www");                 
            });
    ​
    

    Note: inside function this is reference of textarea so you directly use this.value instead of accessing textarea value using id.

提交回复
热议问题