因此,我要提交一个表单,输入按钮的值
是“View Insight”。当我使用 Request 提交表单时,我在 URL 中收到一个令人讨厌的字符串,例如 Insight=View+Insight。
我希望它在 URL 中显示的是“Insight=Confirmed”。我尝试使用 jquery 更改按钮的值,它有效,但您会看到它更改了用户界面中的值。如何在不向用户显示的情况下更改我想要的值?
这是我到目前为止所拥有的:
JQUERY
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#savebtn").bind("click",function(){
$(this).val('confirmed');
});
});
</script>
HTML
<form action="confirm4.php" method="request">
<input type="submit" name="insights" id="savebtn" value="View Insights" />
</form>
最佳答案
您可以将输入[type=submit]更改为按钮[type=submit],如下所示:
<form action="confirm4.php" method="request">
<input type="hidden" name="Insight" value="Confirmed">
<button type="submit" id="savebtn">View Insights</button>
</form>
关于javascript - Jquery - 更改输入按钮的值而不显示值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23616668/