简体   繁体   English

具有多个值的选项标签

[英]Option tag with multiple values

I want my option tag to have multiple values something like 我希望我的选项标签具有多个值,例如

<option value="+1" value="United States">United States</option>

Then: 然后:

  1. I want to call one of the values to java function 我想给Java函数调用值之一
  2. I want to pass the other value to a php form file 我想将其他值传递给php表单文件

This is not supported by html. html不支持此功能。 The only options I can think of is 我能想到的唯一选择是

1) translate the single value so it represents seperate things in the seperate system 1)转换单个值,使其代表独立系统中的独立事物

2) Have the select onchange modify another hidden input value. 2)让select onchange修改另一个隐藏的输入值。

maybe you can choose different attribute for each value. 也许您可以为每个值选择不同的属性。 <option value="United States" value2="+1"> . <option value="United States" value2="+1"> attribute 'value' using for php and 'value2' for java. 属性“值”用于php,“值2”用于java。 i'm not capable in java but in javascript (jquery) it simply call $('option').attr('value2') 我在Java中没有能力,但在javascript(jquery)中它只是调用$('option').attr('value2')

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

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