I am using MVC with C#.
我在C#中使用MVC。
I need to get the value from the hidden field of the active accordion in $(document).ready function.
我需要从$(document).ready函数中获取活动手风琴隐藏字段的值。
3 个解决方案
#1
accordion doesn't add the class selected, but ui-accordion-content-active.
accordion不会添加所选的类,但ui-accordion-content-active。
Try:
alert('value ' + $('.ui-accordion .ui-accordion-content-active input[name$=EId]').val());
#2
Without knowing in more detail what your actual code is like, this is the closest guess I can give:
在不知道您的实际代码是什么的情况下,这是我能给出的最接近的猜测:
$(".ui-accordion .selected input[type=hidden]").val();
jQuery UI accordions have a "ui-accordion" class and automatically apply the "selected" class to the currently expanded accordion element.
jQuery UI手风琴有一个“ui-accordion”类,并自动将“selected”类应用于当前扩展的accordion元素。
#3
I have run into this "strangeness" with jQuery; it seems the selector is returning an array of objects so you have to use the "[0]" to get the element you are looking for.
我用jQuery遇到了这种“陌生感”;似乎选择器返回一个对象数组,因此你必须使用“[0]”来获取你正在寻找的元素。
#1
accordion doesn't add the class selected, but ui-accordion-content-active.
accordion不会添加所选的类,但ui-accordion-content-active。
Try:
alert('value ' + $('.ui-accordion .ui-accordion-content-active input[name$=EId]').val());
#2
Without knowing in more detail what your actual code is like, this is the closest guess I can give:
在不知道您的实际代码是什么的情况下,这是我能给出的最接近的猜测:
$(".ui-accordion .selected input[type=hidden]").val();
jQuery UI accordions have a "ui-accordion" class and automatically apply the "selected" class to the currently expanded accordion element.
jQuery UI手风琴有一个“ui-accordion”类,并自动将“selected”类应用于当前扩展的accordion元素。
#3
I have run into this "strangeness" with jQuery; it seems the selector is returning an array of objects so you have to use the "[0]" to get the element you are looking for.
我用jQuery遇到了这种“陌生感”;似乎选择器返回一个对象数组,因此你必须使用“[0]”来获取你正在寻找的元素。