gpt4 book ai didi

javascript - jQuery 值传递

转载 作者:行者123 更新时间:2023-11-30 13:14:28 24 4
gpt4 key购买 nike

我试图重新设置select option的样式,但是该选项的值不会传递给 jQuery 创建的新类。因此,我无法得到正确的结果。正确的结果是点US显示Austin,点Germany显示Berlin

代码如下 http://jsfiddle.net/xvDbv/1/

应该改成类似的东西

   text: $this.children('option','value').eq(i).text()?

有人可以帮助解决 VALUE 传递问题吗?

非常感谢副词

最佳答案

这是因为在构建伪选择时,您从不调用 countrySelectChanged 函数。在函数中添加对它的调用:

$listItems.click(function(e) {
e.stopPropagation();
$styledSelect.text($(this).text()).removeClass('active');
$this.val($(this).attr('rel'));
$list.hide(); /* alert($this.val()); Uncomment this for demonstration! */
countrySelectChanged();
});

jsFiddle example

关于javascript - jQuery 值传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12593713/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com