动态添加jQuery Mobile的属性

时间:2014-02-05 20:45:34

标签: jquery jquery-mobile attributes collapsable

我在这里将2个表单添加属性data-role =“collapsible”:https://www.myhhf.com/test/test_jq_form.php

表格1位于底部,是正确的。此内容正在内联添加。

表格2不正确。使用$(document).ready(); : $("#form_2").attr("data-role", "collapsible");内的这行代码动态添加此属性。我尝试将.trigger("create")添加到最后,但这没有做任何事情。

表单2正在接收属性,但它无法正常工作。

我相信jQuery Mobile会在加载时应用所有内容。我不是百分百肯定的。但无论是否是这种情况,我都需要做到这一点。我很乐意为你提供任何帮助。

1 个答案:

答案 0 :(得分:0)

您可以通过调用collapsible将其变为$("#form_2").collapsible();。无需添加属性。

相关问题