(jQuery) 如何向对象添加函数,即使该对象尚未创建?
我有这个脚本...
$.post('../script/php/getnumtreated', {
medicalid: $('#medicalid').html(),
numaffected: $('#numaffected').html()
}, function(data) {
if (data == 1) {
//Show #resolve radio button
}
else if (data == 0) {
//Hide #resolve radio button
}
});
单选按钮组最初显示,它有 2 个单选按钮“解决”和“不解决”。
从我的脚本中,“数据”必须等于 1,#resolve 单选按钮必须显示之前,必须等于 0,单选按钮才能隐藏,但单选按钮组仅在单击按钮后出现。
必须首先单击“#add”按钮才能创建单选按钮。单选按钮来自单独的 PHP 脚本。
即使尚未单击 #add,如何访问这些单选按钮?
我正在尝试做类似 live() 的事情
I have this script...
$.post('../script/php/getnumtreated', {
medicalid: $('#medicalid').html(),
numaffected: $('#numaffected').html()
}, function(data) {
if (data == 1) {
//Show #resolve radio button
}
else if (data == 0) {
//Hide #resolve radio button
}
});
The radio button group is initially shown, it has 2 radio buttons 'resolve' and 'not resolve'.
From my script the "data" must be equal to 1 before #resolve radio button has to show and 0 for the radio button to hide, but the radio button group only appears after a button is click.
'#add' button must be click first to create the radio button. The radio buttons comes from a separate PHP script.
How do I access those radio buttons even if #add has not yet been click?
I'm trying to do something similar to live()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您尝试过
$('#resolve').live('....',function()...
吗?did you try
$('#resolve').live('....',function()...
??