I've used jquery-ui tabs in a page. But I want, if someone clicks the link "Click me" in Tab1, it will automatically open the Tab2 for him. I want the link "Click me" to work as same as the Tab2 option works. How can I do that? My codes are given below
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Homepage</title>
<link rel="stylesheet" href="css/jquery_ui.css">
<link rel="stylesheet" href="css/index.css">
<script src="js/jquery.js"></script>
<script src="js/jquery_ui.js"></script>
<script>
$( function() {
$( "#tabs" ).tabs();
} );
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tab_one">Tab1</a></li>
<li><a href="#tab_two">Tab2</a></li>
<li><a href="#tab_three">Tab3</a></li>
<div id="tab_one">
<p>Something about Tab1</p>
<p><a href="">Click me</a></p>
</div>
<div id="tab_two">
<p>Something about Tab2</p>
</div>
<div id="tab_three">
<p>Something about Tab3</p>
</div>
</ul>
</div>
</body>
</html>
I've used jquery-ui tabs in a page. But I want, if someone clicks the link "Click me" in Tab1, it will automatically open the Tab2 for him. I want the link "Click me" to work as same as the Tab2 option works. How can I do that? My codes are given below
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Homepage</title>
<link rel="stylesheet" href="css/jquery_ui.css">
<link rel="stylesheet" href="css/index.css">
<script src="js/jquery.js"></script>
<script src="js/jquery_ui.js"></script>
<script>
$( function() {
$( "#tabs" ).tabs();
} );
</script>
</head>
<body>
<div id="tabs">
<ul>
<li><a href="#tab_one">Tab1</a></li>
<li><a href="#tab_two">Tab2</a></li>
<li><a href="#tab_three">Tab3</a></li>
<div id="tab_one">
<p>Something about Tab1</p>
<p><a href="">Click me</a></p>
</div>
<div id="tab_two">
<p>Something about Tab2</p>
</div>
<div id="tab_three">
<p>Something about Tab3</p>
</div>
</ul>
</div>
</body>
</html>
Share
Improve this question
asked Feb 20, 2017 at 10:51
Nahid SultanNahid Sultan
859 bronze badges
6 Answers
Reset to default 3use target="_blank"
attribute in your anchor tag, like
<li><a target="_blank" href="#tab_one">Tab1</a></li>
Maybe it will help you for custom click jquery-ui-tabs-with-nextprevious
$('#my-text-link').click(function() { // bind click event to link
$tabs.tabs('select', 2); // switch to third tab
return false;
});
Use this:
<p><a href="#tab_two">Click me</a></p>
You can set the id of tab two in href tag of anchor element.
<div><a href="#tab_two">Click here to open tab 2</a></div>
try this..
<li><a href="#" onclick="window.open('your_page.php','newwindow', config='height=700, width=1200, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no')" class="button yellow">Tab1</a></li>
using this link you can open new window with new page.
on the click event of the "Click me" button
Add the below code to acheive it.
$("a[href='#tab_two']").trigger("click");
This should work for you.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744200610a4562861.html
评论列表(0条)