I’ve seen this example floating around on how to insert text at the cursor in a text area:
http://jsfiddle.net/adamadam123/bTUWa/5/
The above works fine but when I’ve tried to add it to my own code (which is primarily jQuery) I find I can’t get it to work anymore – below is an example of my code trying to use the function:
http://jsfiddle.net/adamadam123/bbE48/6/
Can someone help me get the second jsfiddle working. Note: really want to pass the ID across as there are many div’s with different ID’s but all have the same textarea.classname within.
thankyou
<div id="100000000">
<input id="insertPattern" type="button" value="insert pattern" />
<textarea class="chatMessengerFooterTextArea">insert some text into this string</textarea>
</div>
You can use
nextto get the input:http://jsfiddle.net/bbE48/13/