javascript - How to get CodeMirror value without defining variable? -


i'm using multiple codemirror areas on page , im defining them in js:

function editor(id){   codemirror.fromtextarea(document.getelementbyid(id), {     linenumbers: false,     styleactiveline: true,     matchbrackets: true   }); } 

and later call function on textareas -

$j = 0; while($row = mysql_fetch_array($formulas)) {   echo "   <textarea id='code".$j."'>;some code</textarea>   --not important code--   <script>editor('code".$j."');</script>";   $j++; } 

and later, according solution site i'm refreshing part of codemirrors because of placing them in hidden div this

settimeout(function() {   $('.my-hidden-div .codemirror').each(function(i, el){       el.codemirror.refresh();   }); 

now need values of codemirrors blocks clicking in button in same row , send them via ajax problem appears.

how can value of them using $(this).closest('tr') guys? important me not define codemirror variable because i'm supporting dynamic deleting , adding new codemirrors textareas. anyway if did it, getting error js cannot recognize variable, defined in other js function , it's not global. me guys , have nice day. greetings.

the same thing you're using call refresh, accessing codemirror property on dom node, can used call getvalue well.


Comments

Popular posts from this blog

How do you convert a timestamp into a datetime in python with the correct timezone? -

how to display 2 form fields on same line with bootstrap -

c# - how to use buttonedit in devexpress gridcontrol -