JQueryUI 手风琴changestart 事件 - 如何从中获取数据?
http://jqueryui.com/demos/accordion/#event-changestart
我我试图让 JQuery ajax 请求获取一些数据,并在展开行时填充每个 JQueryUI 手风琴行内的 div 正文。我的目的是在手风琴的可点击 h3 中设置一个隐藏字段,或者类似的字段,当 Changestart 事件触发时,ajax 将关闭并为该手风琴行获取一个唯一的页面,并用有用的 html 填充它。
我的问题是,我似乎找不到有关更改启动事件函数参数中返回的对象所附加的属性或值的任何信息。有谁知道如何做到这一点或获得这些值?
我现在拥有的代码是这样的:
$("#accordion").accordion({
collapsible: true,
active: false,
changestart: function(event, ui) {
alert('hello:' + event.target.id + ':' + ui.id);
}
});
它会抛出一个警报,显示消息 hello:accordion:undefined
我已经看过这篇文章,它似乎符合我想要弄清楚的内容出去... “ui”的 jQuery UI 对象类型对象传递给回调函数?
谢谢,
马特。
http://jqueryui.com/demos/accordion/#event-changestart
I'm trying to have an JQuery ajax request get some data and populate the body of a div inside each of my JQueryUI accordion rows when the row is expanded. My intention is to have a hidden field, or some such, within the clickable h3's of the accordion and when the changestart event fires the ajax will go off and get a unique page for that accordion row and fill it with useful html.
My problem is that I can't seem to find any information about the properties or values attached to the objects returned in the changestart event function parameters. Does anyone know how to do this or get those values?
The code I have right now is this:
$("#accordion").accordion({
collapsible: true,
active: false,
changestart: function(event, ui) {
alert('hello:' + event.target.id + ':' + ui.id);
}
});
Which throws up an alert displaying the message hello:accordion:undefined
I've seen this post which seems to be along the lines of what I'm trying to figure out...
jQuery UI object type for "ui" object passed to the callback function?
Thanks,
Matt.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来像
ui
包含这个:Looks like
ui
holds this:您可以轻松访问这些 ui.new|old 元素的内容。
它们是 jQuery 元素,这就是为什么它们看起来有点奇怪。
jQuery 方式
如果您需要访问 dom 元素,请使用 .get()
You can access the contents of those ui.new|old elements easily.
They are jQuery elements, that is why they look a bit odd.
jQuery way
And if you need access to the dom element use .get()