Javascript 框架表单提交上的html重置文本区域
我想重置提交时发送数据而不更改页面的文本区域Javascript 框架表单提交上的html重置文本区域,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我想重置提交时发送数据而不更改页面的文本区域 <iframe name="votar" style="display:none;"></iframe> <form id ="myForm" action="message-process.php" method="post" target="votar"> <?php echo "<input type='hidden' name='userId' value
<iframe name="votar" style="display:none;"></iframe>
<form id ="myForm" action="message-process.php" method="post" target="votar">
<?php
echo "<input type='hidden' name='userId' value= '$sendId'>";
?>
<textarea rows="5" cols="60" name="message" type="text" maxlength="255" style="font-size:10px background-color:grey;"></textarea>
<input type="submit" value="Send Message">
</form>
您可以使用HTML表单属性onsubmit=“func()”
在Javascript脚本中,将希望的值设置为空字符串 此代码有效
<iframe name="votar" style="display:none;"></iframe>
<form id ="myForm" action="message-process.php" method="post" target="votar" onsubmit="this.submit(); this.reset(); return false;">
<?php
echo "<input type='hidden' name='userId' value= '$sendId'>";
?>
<textarea id ='input' rows="5" cols="60" name="message" type="text" maxlength="255" style="font-size:10px background-color:grey;"></textarea>
<input type="submit" value="Send Message">
</form>
«不更改页面»。。。查找Ajax.function reset(){document.getElementById(“input”).value=“”;}如果我在文本区域中包含一个id标记,这是否有效?