[英]css class is not working in mvc4 using jquery
我有一个视图页面,并且在其中应用了一个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
但是,当我运行我的页面CSS类Highlight1时,未将其应用于指定的ID,any1可以帮助我为什么会发生这种情况。
尝试
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");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.