Codeigniter:POST数据属性HTML5 [英] Codeigniter : POST data- attributes HTML5

查看:164
本文介绍了Codeigniter:POST数据属性HTML5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的是CodeIgniter框架,我在HTML5中的数据属性有一个问题,我不知道如何从下拉菜单中输入我的形式传递数据属性。

I'm currently using the CodeIgniter's Framework and I have a problem with data- attributes in HTML5 and I don't know how to pass data-attributes from a dropdown input in my form.

我知道如何使用jQuery,但我不知道是否有任何解决方案来获取数据属性和识别我的数据类型。

I know how to do it with jQuery but I don't know if is there any "solutions" to get the data attributes and recognize my type of data.

这是我的代码:

<select name="username">
<option value="1" data-attributes="users">Simon</option>
<option value="1" data-attributes="collectives">My super crew</option>
</select>

如果你对我有一些灯光,请提前预订。

Thaks in advance if you have some lights for me.

Simon

推荐答案

data - *

如果要以表单提交数据,请使用 value

If you want to submit data in a form, then use the value attribute.

<option value="users">Simon</option>
<option value="collectives">My super crew</option>

您可以根据需要对多个不同的数据进行编码。

You can encode multiple different pieces of data there if you like.

例如管道分隔数据:

<option value="1|users">Simon</option>
<option value="1|collectives">My super crew</option>

JSON:

<option value="{&quot;number&quot;: 1, &quot;string&quot;: %quot;users%quot;}">Simon</option>
<option value="{&quot;number&quot;: 1, &quot;string&quot;: %quot;collectives%quot;}">My super crew</option>

这篇关于Codeigniter:POST数据属性HTML5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆