在点击它时获取与特定标签相对应的详细信息 [英] get the details corresponding to particular tab on click of it
本文介绍了在点击它时获取与特定标签相对应的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Html部分:
Html part:
<div class="tab-content">
<div class="tab-pane active" id="tab2">
<div class="row-fluid">
<div class="span9 offset1">
<header id="second">
<strong>Users</strong>
</div>
<div class="span2">
<div class="tabbable" align="center">
<ul class="nav nav-pills">
<li class="active"><a href="#mobile" data-toggle="tab"><strong>Mobile</strong>
</a>
</li>
<li><a href="#BO" data-toggle="tab"><strong>BO</strong>
</a>
</li>
</ul>
</div></div></div></div></div></div>
javascript部分;
javascript part;
var users;
$(document).ready(function() {
jQuery.support.cors = true;
loadUsers('mobile');
});
function loadUserDetails(id) {
$.get('http:somelink' + id, function(data) {
}
function test(name)
{
alert("test");
}
function loadUsers(type) {
$.get('http://some link' + type, function(data) {
});
}
在我的代码中,默认情况下,类型是移动的,我想要的是如果我点击BO选项卡上的javascript函数根据那个工作如何实现
In my code i by default type is mobile i want if i click on BO tab the javascript function works according to that. How can i achieve that
推荐答案
您需要添加一个点击处理程序
You need to add a click handler
jQuery(function($) {
$('.tabbable ul li').click(function() {
var id = $(this).find('a').attr('href').substring(1);
loadUsers(id);
})
})
这篇关于在点击它时获取与特定标签相对应的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文