Not being able to get next textarea working
I have a textarea after a div and I'm using rangyinputs to insert some
text in that area, like surrounding etc.
If I use the following code it works:
window.surround5 = function surround5(text2,text3){
$("#textarea5").surroundSelectedText(text2, text3);
}
being textarea5 the class name, but I didnt wanted to use class name so I
tried with:
window.surroundtest = function surroundtest(text2,text3){
var c = $(this).next('textarea');
c.surroundSelectedText(text2, text3);
}
But It keeps getting me some error about nodes on rangyinputs that doesnt
show in the other way. If I do a alert it shows "object object" so its
actually finding the textarea right?
The implementation would be for something like:
<div>
<div onclick="surroundtest('[center]', '[/center]');">Center</div>
</div>
<textarea ....>
Edited with the div that is making the call.
JSFIDDLE: http://jsfiddle.net/qmpY8/
No comments:
Post a Comment