Correct, you can use val(), however you are using PERL not PHP, and this guy already answered your exact question on stack overflow.
thibauts
http://stackoverflow.com/questions/17523851/how-can-i-retrieve-a-current-value-of-textarea
Please try to keep your questions relevant to this list.thibauts
http://stackoverflow.com/questions/17523851/how-can-i-retrieve-a-current-value-of-textarea
On Tue, Jul 9, 2013 at 10:53 AM, Andrew Cassell <alc277@gmail.com> wrote:
You can use the .val() on the textarea if the textarea is a jQuery object or set of elements.See the example usage on:(I'm a bit confused by your problem -- but hopefully this helps).Note: .val() strips carriage returns on textareas.
On Tuesday, July 9, 2013 7:55:26 AM UTC-4, Sanjay Rathod wrote:--i have two files1)index.phpand2)code.jsnow code in index.php is below<html><head><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script><link href="http://web.guru99.com/lib/codemirror.css" rel="stylesheet" /><script type="text/javascript" src="code.js"></script><style type="text/css">.CodeMirror {border: 1px solid #eee;height: auto;}.CodeMirror-scroll {height: auto;overflow-y: hidden;overflow-x: auto;}</style></head><body>Integer : whole numbers e.g. -3, 0, 69. The maximum value of an integer is platform-dependent. On a 32 bit machine, its usually around 2 billion. 64 bit machines usually have larger values. The constant PHP_INT_MAX is used to determine the maximum value.<pre class="codeguru">say 'hi';</pre>Let us now look at how PHP determines the data type depending on the attributes of the supplied data.<pre class="codeguru">say 'hello';</pre>Floating point numbers<pre class="codeguru">say 'you r amazing';</pre>Character strings<pre class="codeguru">say 'i am fine';</pre></div><form class="hidden code-box" method="GET" name="sample"><div dir="ltr"><textarea class="php" name="codeguru"></textarea></div><input type="submit" value="Run" onclick="execute();"/></br></br>Output:</br></br><textarea id="print-result" disabled="true" cols="77"></textarea></br></form></div></body></html>and code.js file contain code is given below$(document).ready(function(){$('pre.codeguru').each(function(){var pre = this;var form = $('form[name=sample]').clone();$(form).removeAttr('name');$(form).removeClass('hidden');$($(form).find('textarea')[0]).val($(pre).text());var id = $(pre).attr('id');$(form).find('div textarea[name=code]').first().attr('id', id);$(pre).replaceWith(form);});window.editors = [];$('textarea[name=codeguru]').each(function(){window.editor = CodeMirror.fromTextArea(this,{lineNumbers: true,matchBrackets: true,mode: "application/x-httpd-perl",tabMode: "shift"});editors.push(editor);});});function execute() {p5pkg.CORE.print = function(List__) {var i;for (i = 0; i < List__.length; i++) {document.getElementById('print-result').value += p5str(List__[i])}return true;};p5pkg["main"]["v_^O"] = "browser";p5pkg["main"]["Hash_INC"]["Perlito5/warnings.pm"] = "Perlito5/warnings.pm";var source = editor.getValue();alert(source);var pos = 0;var ast;var match;document.getElementById('print-result').value = "";try {var start = new Date().getTime();var js_source = p5pkg["Perlito5"].compile_p5_to_js([source]);var end = new Date().getTime();var time = end - start;// runstart = new Date().getTime();eval(js_source);end = new Date().getTime();time = end - start;}catch(err) {//document.getElementById('log-result').value += "Error:\n";}}everything is run fine in my code. in code.js pre tags are replaced by textarea and the code in textarea should be run because this project is of online perl editor. so now my problem is i have alert the value of text area by this codevar source = editor.getValue();alert(source);but that gives the blank pop up. so what i have to do for retrieve current value of textarea?
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net
To post, send email to washington-dcphp-group@googlegroups.com
To unsubscribe, send email to washington-dcphp-group+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
~M
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net
To post, send email to washington-dcphp-group@googlegroups.com
To unsubscribe, send email to washington-dcphp-group+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
nice article for beginners.thank you.
ReplyDeletepython tutorial
java tutorial