I have a view page and in which i applied a Jquery like
我有一个视图页面,我在其中应用了一个Jquery
<script type="text/javascript">
$(document).ready(function () {
var hdrname = $('#headername').text();
alert(hdrname);
if (hdrname == "Pending Assignment") {
$('#lst1').addClass('highlight1');
alert("hcsgiahf");
$('#tab2').removeClass('highlight1');
}
else if (hdrname == "Assigned With L1 Support") {
alert($('#tab1').text());
alert("hello");
$('#tab1').removeClass('highlight1');
$("#tab2").addClass("highlight1");
}
//To get No of call start
});
//To get No of call end
But when i am running my page css class highlight1 is not applied on the specified id, can any1 help me why it happens..
但是当我运行我的页面时,css类的highlight1没有应用于指定的id,any1可以帮助我为什么会发生..
1 个解决方案
#1
1
Try
if (hdrname == "Pending Assignment") {
$('#tab1').addClass('highlight1');// i think you are wrong here
alert("hcsgiahf");
$('#tab2').removeClass('highlight1');
}
else if (hdrname == "Assigned With L1 Support") {
alert($('#tab1').text());
alert("hello");
$('#tab1').removeClass('highlight1');
$("#tab2").addClass("highlight1");
}
你的代码在这里工作
#1
1
Try
if (hdrname == "Pending Assignment") {
$('#tab1').addClass('highlight1');// i think you are wrong here
alert("hcsgiahf");
$('#tab2').removeClass('highlight1');
}
else if (hdrname == "Assigned With L1 Support") {
alert($('#tab1').text());
alert("hello");
$('#tab1').removeClass('highlight1');
$("#tab2").addClass("highlight1");
}
你的代码在这里工作