javascript - 如何获取jquery mobile显示的页面的 "id"

标签 javascript html jquery-mobile

我有很多这样的html页面

<body onload="init()">

<div data-role="page" id="home">
<div data-role="header">
<h1>Here is the index page.</h1>
</div>

<div data-role="content">
<p><center>Below you may transition to our other pages.</center></p>

<a href="#about" data-ajax="false" data-role="button" data-inline="true">About  Me</a>
</div>
</div>

<div data-role="page" id="about">
<div data-role="header">
<h1>About Us</h1>
</div>

<div data-role="content">
<a href="#home" data-ajax="false" data-role="button" data-inline="true">Back Home</a>
</div>
</div>
</body>

现在我需要获取当前显示的页面的 ID...该怎么做?

最佳答案

你试过了吗:$.mobile.activePage.attr('id')

关于javascript - 如何获取jquery mobile显示的页面的 "id",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10242683/

相关文章:

javascript - VueJS - 条件组件鼠标事件

javascript - MIDI.js 音符持续时间不会改变

html - 以纯色为背景的 SVG 形状透明度

javascript - 如果更改事件未绑定(bind)然后反弹,下拉选项 "change"不起作用

java - 如何处理servlet上没有请求

javascript - 使用JavaScript的C3数据的数据结构/格式

javascript - 用另一个替换现有图像

javascript - 如何使用 addEventListener 更改 div 的颜色

javascript - 处理 html 中的文本 : associating attributes to sentences

android - Jquery Mobile 和 Swipe JS 不兼容导致选择列表无法在 Android 上运行