既然有这样的时刻,为什么下面的示例不起作用?当用户双击文本区域时,我希望文本转换为大写。
<textarea id="property_summary" name="property_summary" rows="5" cols="70" class="countcharacters" data-limit="1000" data-report="summary_cc" ondblclick="property_summary.value.toUpperCase();" required>This is test text</textarea>
最佳答案
property_summary.value.toUpperCase()
不是赋值。
尝试
this.value = this.value.toUpperCase();
关于javascript - 使用 Javascript 将 textarea 文本转换为大写 ondblclick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35462122/