如何获得“价值”的过滤选择< select>在dojo? [英] How to get the "value" of a FilteringSelect <select> in dojo?

查看:88
本文介绍了如何获得“价值”的过滤选择< select>在dojo?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用dijit.form.FilteringSelect来提供从< select>中选择值的方法。问题是,使用dojo时,会返回标签,而不是s的值。

I am using dijit.form.FilteringSelect to provide a way to select values from a <select>. The problem is, when using dojo, the label is returned instead of the value of the s.

例如:

< select name =testdojoType =dijit.form.FilteringSelect>

< option value =1> One< / option>

< option value =2> Two< / option>

< / select>


Dojo正在返回文字如果选择该选项,则为1,而不是该选项的值为1。对于two和2也是如此。

For example:
<select name="test" dojoType="dijit.form.FilteringSelect">
<option value="1">One</option>
<option value="2">Two</option>
</select>

Dojo is returning the literal "one" if that option is selected, instead of the value for that option, "1". The same is true for "two" and "2".

如果从这个元素中删除了dojo,则会按预期的方式返回值。

If dojo is removed from this element, the value is returned as expected.

推荐答案

我发现dojo创建了2个元素。一个使用名称,其中包含使用元素的NAME的值,另一个包含使用该元素的ID的选项的标签。由于我正在使用document.getElementById(),所以返回错误的值。使用名称中的值提供正确的结果。

I have found out that dojo creates 2 elements. One using the name, which contains the value which uses the NAME of the element, and another which contains the label for the option, which uses the ID of the element. Since I was using document.getElementById(), this was returning the wrong value. Using the value from the name provides the correct result.

这篇关于如何获得“价值”的过滤选择&lt; select&gt;在dojo?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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