textarea不返回值 [英] textarea doesnt return value
问题描述
我在我所有的文本区域中都使用代码编辑器 codepress ,但没有textarea返回价值.我认为不同的名称和ID是问题所在.示例:
Im using a code editor codepress in all of my textareas, but no textarea return a value. I think the different name and id is the problem. Example:
<textarea name="content_text" rows="20" cols="50" class="codepress sql" id="myCpWindow"></textarea>
我在这里某处读过一篇文章,使用隐藏的输入来传递textarea的值,但是我自己做不到!
I have read somewhere in here to use a hidden input to transfer the textarea's value, but i cant do it myself!
好吗?
推荐答案
这对我有用.
如果textarea的名称和ID相同,则会破坏javascript.对于文本区域,我只需分配一个ID,然后添加一个隐藏的输入字段,其名称是我希望在表单处理过程中收集的名称;然后使用onsubmit将codepress分配给隐藏的输入,如下所示:
This worked for me.
If the name and id of the textarea are the same, it breaks the javascript. For the textarea i just assign an ID and I add a hidden input field with the name I wish to collect in the form process; then using the onsubmit to assign the codepress to the hidden input like this:
<form action="something" onsubmit="codeText.value = codeTextArea.getCode();">
<textarea id="codeTextArea" rows="20" cols="50" class="codepress java"></textarea>
<input type="hidden" name="codeText"/>
<input type="Submit">
</form>
这篇关于textarea不返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!