php - Not being able to get next textarea working -


i have textarea after div , i'm using rangyinputs insert text in area, surrounding etc.

if use following code works:

window.surround5 = function surround5(text2,text3){ $("#textarea5").surroundselectedtext(text2, text3); } 

being textarea5 class name, didnt wanted use class name tried with:

window.surroundtest = function surroundtest(text2,text3){ var c = $(this).next('textarea'); c.surroundselectedtext(text2, text3); } 

but keeps getting me error nodes on rangyinputs doesnt show in other way. if alert shows "object object" finding textarea right?

the implementation like:

<div> <div onclick="surroundtest('[center]', '[/center]');">center</div> </div> <textarea ....> 

edited div making call.

jsfiddle: http://jsfiddle.net/qmpy8/

remember, in jquery, if want select element class, by

$('.elementclass') //select 1 or more element class 

the # selector id's, not classes.

$('#elementid') //select 1 element id 

hope helps.

if want select textarea. , if 1 textarea.

as this:

$('textarea') 

i still don't persistence in don't use id's or class.

the way solve it, passing id function, so, in way, doesnt matter how many textareas appears on html.

<div> <div class="guides_chapters_button" onclick="surround('[center]', '[/center]', 'textareamatch');">center</div> <div class="guides_chapters_button" style="text-decoration: underline;" onclick="surround('[u]','[ u/]', 'textareamatch');">u</div> 

window.surround = function surround(text2,text3, id){     $("#" + id).surroundselectedtext(text2, text3); } 

i tested , it's works. http://jsfiddle.net/wnrwc/

greetings méxico.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -