繁体   English   中英

如何在单击“提交”之前获取同一视图页面中输入框的值?

[英]how to get the value of input box in the same view page before clicking on submit?

大家晚上好..我有一个问题属于php-codeigniter形式。 我在查看页面中有一个表单,如下所示:

echo form_open('someaction');
echo form_input('some_name',$some_value);
// here i want get the value before submitting.
echo form_submit('submit','submit');
echo form_close();

我想在单击提交之前在同一视图页面中获得该输入框的值。 我没有任何控制器和模型。 只有我上面提到的表格。

您可以使用JavaScript来做到这一点

<script type="text/javascript">
    var val = document.getElementById('id_here');
    // .... you can do anything with the value now
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM