I want to replace a particular string in #TextArea1. This happens when a button is clicked.
Trying it out with the below code, but unable to get it work:
$('#TextArea1').text().replace("wef","--");
What is the correct syntax to replace a word in a div?
replace()creates a new string and returns it, so it’s getting returned into thin air. You need to grab the new string and send it back into the textbox. This jsfiddle shows how.