maybe you can generate elements like this: <ul id="city"> <li value="021">上海</li> <li value="010">北京</li> </ul> when you select a item, you can add a class like "selected" to the li notation, when you submit the form, you can get the value easily $("#city .selected").attr("value"); hope this can help you
<option value="010">北京</option>
提交不就是代号了么。?
我使用的是动态生成ul、li
<ul id="city">
<li value="021">上海</li>
<li value="010">北京</li>
</ul>
when you select a item, you can add a class like "selected" to the li notation, when you submit the form, you can get the value easily $("#city .selected").attr("value");
hope this can help you
//先在li上添加数据
li.data('value',1)
//...
//提交时
$.post(
//...
data:{value:li.data('value')}
)
或者像前面说的,直接在LI上加上value属性也可以的,虽然li直接没有这属性
那通过Form将数据输送到服务器端咋做呢,我这个是做成插件,所以用户只是引用就行,这样的话上传的值仍是li直接的值,而非我要的value