以表单形式将onfocus添加到codeigniter数组中
我想将 onfocus 命令添加到 Codeigniter 中的数组中。我通常将此代码添加到我的输入中:
onfocus="this.value=''"
我正在使用一个数组(见下文),并且需要知道如何向其中添加 onfocus(如果不能在数组中完成,那么可以在哪里完成
$login = array(
'name' => 'login',
'id' => 'login',
'value' => set_value('login', 'Email'),
);
?对于输入:
<?php echo form_input($login); ?>
I'd like to add an onfocus command to an array in Codeigniter. I generally add this code to my inputs:
onfocus="this.value=''"
This I'm using an array (see below) and need to know how to add onfocus to it (and if it can't be done in an array, where can it be done?
$login = array(
'name' => 'login',
'id' => 'login',
'value' => set_value('login', 'Email'),
);
and for the input:
<?php echo form_input($login); ?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在页面加载后执行此操作,以便更好地控制页面。试试这个。
You can do this once the page is loaded to have a better control on it. Try this.
您可以将其添加为数组的另一部分:
但是请参阅@ShankarSangoli 帖子,这是管理这种情况的更好方法。
You can just add it as another part of the array:
However see @ShankarSangoli post, that’s a better way to manage the situation.
如果您希望表单包含一些附加数据,例如 Javascript,您可以将其作为第三个参数中的字符串传递:
所有内容均记录在 codeigniter
希望这有帮助!
If you would like your form to contain some additional data, like Javascript, you can pass it as a string in the third parameter:
It is all documented over at codeigniter
Hope this helps!