【问题标题】:jquery mobile update anchor textjquery移动更新锚文本
【发布时间】:2013-06-18 19:46:47
【问题描述】:

当我更改锚文本时 - 我失去了所有的 CSS。我不知道如何保留CSS。我什至尝试将 CSS 注入回来,但仍然没有。我试过('刷新')但仍然没有。可能是我用错了。

(使用 jQuery Mobile 1.3.1 和 jQuery 1.9.1)

**查看这张图片 --> http://www.appmalt.info/img/test.png

HTML

<div data-role='content' data-theme='b'>
    <a href='#leftPanel' data-role='button' data-theme='b' data-icon='list' data-iconpos='left' id='bTitle'>Acceleration</a>
    ........
    ........
</div>

jQuery

//The trigger initiates and calls a function. The function contains this
$('#bTitle').text('Area')
            .attr('data-role','button')
            .attr('data-icon','list')
            .attr('data-iconpos','left')
            .attr('data-theme','b')
            .css('text-decoration','none')
            .trigger('refresh');

文本更改得很好,但所有 CSS 都消失了。

【问题讨论】:

    标签: jquery css jquery-mobile refresh anchor


    【解决方案1】:

    试试

    $("#bTitle .ui-btn-text").text('new_text')
    

    因为 jQuery Mobile 自己创建跨度。

    【讨论】:

    • 还有 6 分钟我才能给你答案
    猜你喜欢
    • 1970-01-01
    • 2012-08-24
    • 1970-01-01
    • 2013-02-27
    • 1970-01-01
    • 2014-05-27
    • 1970-01-01
    • 2012-06-09
    • 1970-01-01
    相关资源
    最近更新 更多