On some of our forms we convert our textareas over to tinyMCE textareas. How can I tell in jquery if a given textarea has been converted?
I’ve notice that tinyMCE will change the display of my original textarea to none upon init and then creates an adjacent span with a class of mceEditor, but the follow jquery statements never seems to find it.
if ( $(formElm).siblings(‘span .mceEditor’).size() > 0) { …do this};
or
if( $(formElm).parent().find(‘span .mceEditor’).length > 0 ) {…do this};
or
if( $(formElm).parent().children(‘span .mceEditor’).size() > 0 ) {…do this};
[EDIT]
There was a request for what the textarea looks like after tinymce is done with it. Here goes
<td class='fields'> <textarea id='serviceDesc' class='form req blob' style='display: none;'> Warm and yummy in your tummy<br /></textarea> <span id='serviceDesc_parent' class='mceEditor defaultSkin'> <table id='serviceDesc_tbl' class='mceLayout' cellspacing='0' cellpadding='0' style='width: 400px; height: 152px;'> <tbody> <tr class='mceFirst'> <td class='mceIframeContainer mceFirst mceLast'> <iframe id='serviceDesc_ifr' frameborder='0' src='javascript:''' style='width: 100%; height: 129px;'> <html> </html> </iframe> </td> </tr> <tr class='mceLast'> </tr> </tbody>
Quick tip: It may be that you’ve put a space after the span (in the selector), which makes jQuery look for an element with a class named ‘mceEditor’ in the span.