请参考下面的代码,我正在学习 jquery,我想显示 标签名为#child on submit button click using javascript/jquery 任何人都可以帮助我如何调用按钮点击
还想打电话给#child和#home >>(下一个按钮)和<<(上一个按钮)**上的标签分别在代码中单击>>和<<写为<和&glt。?谁能帮我吗 ?
<div data-role="page" id="home"> <div data-theme="d" data-role="header"> <h3> The Grand Bhagvati </h3> <a data-role="button" data-inline="true" data-direction="reverse" data-transition="slide" href="#home"> << </a> <a data-role="button" data-inline="true" data-direction="reverse" data-transition="fade" href="#child"> >> </a> </div> <div data-role="content"> <div data-role="fieldcontain"> <fieldset data-role="controlgroup" data-mini="true"> <label for="textinput1"> User: </label> <input id="textinput1" placeholder="Khushu" type="text" /> </fieldset> </div> <input data-theme="d" ="submitbtn" value="Login" type="submit" onSubmit="redirect()"/> </div> <div data-theme="a" data-role="footer" data-position="fixed" > <h3> Page1 </h3> </div> </div>
<div data-role="page" id="child"> <div data-theme="d" data-role="header"> <h3> The Grand Bhagvati </h3> <a data-role="button" data-inline="true" data-direction="reverse" data-transition="slide" > << </a> <a data-role="button" data-inline="true" data-direction="reverse" data-transition="fade" > >> </a> </div> <div data-role="content"> <div data-role="fieldcontain"> <fieldset data-role="controlgroup" data-mini="true"> <label for="textinput1"> User: </label> <input id="textinput1" placeholder="Khushu" type="text" /> </fieldset> </div> <input data-theme="d" value="Login" type="submit" onsubmit="redirect()"/> </div> <div data-theme="a" data-role="footer" data-position="fixed" > <h3> Page1 </h3> </div> </div>
问问题
17419 次
2 回答
1
显示标签使用
$('#child').show(); // where child is the id of the element
并隐藏...
$('#child').hide();
或者,您可以简单地在隐藏/显示之间切换,如下所示:
$('#child').toggle();
将这些附加到按钮的 onclick 事件...
$(document).ready(function() {
$('#buttonID').click(function() {
$('#child').toggle();
});
});
希望这可以帮助
于 2012-04-21T09:04:53.053 回答
0
以下代码用于javascript
var Home= document.getElementById("home");
Home.style.display="none";//To hide the div
Home.style.display="";//To display the div
于 2012-04-21T09:22:18.610 回答