【发布时间】:2013-04-03 10:58:26
【问题描述】:
我在我的应用程序中使用 jQuery 按钮,但由于某种原因,它显示为没有 jQuery 属性的普通按钮。 html 标记位于名为ajax.php 的单独文件中,而 jQuery 位于主文件中。
这里是 jQuery 的代码:
$(".back_to_list").button().live("click", function(){
});
这是按钮的 html 标记:
$html = '';
$html .= '<table>
<tr>
<td><button class="back_to_list" >Back</button></td>
</tr>
</table>';
echo $html;
有谁知道为什么按钮不显示为 jQuery ui 按钮?
【问题讨论】:
-
.button()来自jQueryUI,它不属于jQuery Core。 -
请注意,.live()在 1.7 中已弃用,并在 1.9 JQuery 版本中删除。
-
@Vucko,这已被注意到,1.7 版正在用于此特定应用程序
-
你在 jquery lib 下有 jQuery ui 插件吗?
-
我在其他地方使用过 jQuery 按钮,它们都可以工作,但由于某种原因,这个按钮保持不变