jquery:.load() 之后不应用移动样式

发布于 2024-11-08 12:18:53 字数 713 浏览 1 评论 0原文

$('#quest').click(function() {
                    $('#replaceit').load('class/cars.php?q=true',function(){$('#replaceit').collapsible('refresh');});

“在初始化之前无法调用可折叠上的方法;尝试调用方法‘刷新’”

生成的 Html 代码似乎工作正常,例如:

<div data-collapsed="true" data-role="collapsible">
<h1>Which warranty policy of the following is the best for you?</h1>
<p><input type="checkbox" value="2yearsunlimittedkilometers" name="question[Warranty][]">2 years unlimitted kilometers
<input type="checkbox" value="3yearsor60000kilometers" name="question[Warranty][]">3 years or 60000 kilometers
</p></div>

但它的样式尚未设计为可折叠:(.. 有任何线索吗?

$('#quest').click(function() {
                    $('#replaceit').load('class/cars.php?q=true',function(){$('#replaceit').collapsible('refresh');});

"cannot call methods on collapsible prior to initialization; attempted to call method 'refresh'"

Html code that is generated seems to be working fine eg:

<div data-collapsed="true" data-role="collapsible">
<h1>Which warranty policy of the following is the best for you?</h1>
<p><input type="checkbox" value="2yearsunlimittedkilometers" name="question[Warranty][]">2 years unlimitted kilometers
<input type="checkbox" value="3yearsor60000kilometers" name="question[Warranty][]">3 years or 60000 kilometers
</p></div>

but yet its not styled into collapsable :(.. any clue ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掀纱窥君容 2024-11-15 12:18:53

看起来你在函数调用中缺少一些右括号

你有这个:

$('#quest').click(function() {
    $('#replaceit').load('class/cars.php?q=true',function() {
        $('#replaceit').collapsible('refresh');
});

看起来应该是这样:

$('#quest').click(function() {
    $('#replaceit').load('class/cars.php?q=true',function() {
        $('#replaceit').collapsible('refresh');
    })
});

而且我从来没有见过这个:

collapsible('refresh')

你能提供它的文档/示例吗?

也许可以尝试:

$('#replaceit').collapsible().page();

HTML 标记的替代语法:实时示例: http://jsfiddle.net/Rj6AW/4/< /a>

<div data-role="page" id="home"> 
    <div data-role="content"> 
        <div data-collapsed="true" data-role="collapsible">
            <legend>Which warranty policy of the following is the best for you?</legend>
            <fieldset data-role="controlgroup" data-role="fieldcontain">                
                <input type="checkbox" value="2yearsunlimittedkilometers" name="question[Warranty][]" id="2yearsunlimittedkilometers" />
                <label for="2yearsunlimittedkilometers">2 years unlimitted kilometers</label>
                <input type="checkbox" value="3yearsor60000kilometers" name="question[Warranty][]" id="3yearsor60000kilometers" />
                <label for="3yearsor60000kilometers">3 years or 60000 kilometers</label>
            </fieldset>
        </div>
    </div>
</div>

Looks like you're missing some closing brackets in the function call

You have this:

$('#quest').click(function() {
    $('#replaceit').load('class/cars.php?q=true',function() {
        $('#replaceit').collapsible('refresh');
});

Looks like it should be this:

$('#quest').click(function() {
    $('#replaceit').load('class/cars.php?q=true',function() {
        $('#replaceit').collapsible('refresh');
    })
});

Also I'v never seen this:

collapsible('refresh')

Could you provide documentation/examples of it?

Maybe try:

$('#replaceit').collapsible().page();

Alternative Syntax for your HTML markup: Live Example: http://jsfiddle.net/Rj6AW/4/

<div data-role="page" id="home"> 
    <div data-role="content"> 
        <div data-collapsed="true" data-role="collapsible">
            <legend>Which warranty policy of the following is the best for you?</legend>
            <fieldset data-role="controlgroup" data-role="fieldcontain">                
                <input type="checkbox" value="2yearsunlimittedkilometers" name="question[Warranty][]" id="2yearsunlimittedkilometers" />
                <label for="2yearsunlimittedkilometers">2 years unlimitted kilometers</label>
                <input type="checkbox" value="3yearsor60000kilometers" name="question[Warranty][]" id="3yearsor60000kilometers" />
                <label for="3yearsor60000kilometers">3 years or 60000 kilometers</label>
            </fieldset>
        </div>
    </div>
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文