Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AddClass不起作用-无法定义| jquery_Jquery - Fatal编程技术网

AddClass不起作用-无法定义| jquery

AddClass不起作用-无法定义| jquery,jquery,Jquery,在我的jquery代码中 $("#hospital-icon-jquery i").addClass("current-icon-yellow"); 代码行不起作用 完整代码: jQuery(function($) { $(".ea-standard form div.step").not(':eq(0)').hide(); } ); jQuery(function($){ $(document).on('cha

在我的jquery代码中

$("#hospital-icon-jquery i").addClass("current-icon-yellow");
代码行不起作用

完整代码:

jQuery(function($) {
    $(".ea-standard form div.step").not(':eq(0)').hide();
} );    

jQuery(function($){
  $(document).on('change', 'select[name="location"]', function(){
if ($(this).val() !== '') {
  $(".ea-standard form div.step").show(); //show all
  $(".ea-standard form div.step").not(':eq(1)').hide(); //then hide some
  $("#location-icon-jquery i").removeClass( "current-icon-yellow" ).addClass("active-icon-green");
    $("#hospital-icon-jquery i").addClass("current-icon-yellow");
} } ) } );

jQuery(function($){
  $(document).on('change', 'select[name="service"]', function(){
if ($(this).val() !== '') {
  $(".ea-standard form div.step").show(); //show all
  $(".ea-standard form div.step").not(':eq(2)').hide(); //then hide some
  $("#hospital-icon-jquery i").removeClass( "current-icon-yellow" ).addClass("active-icon-green");
   $("#doctor-icon-jquery i").addClass("current-icon-yellow");
} } ) } );

jQuery(function($){
$( '<div class="container"><div class="row"> <span class="col-md-2" id="location-icon-jquery"> <i class="fas fa-map-marker-alt current-icon-yellow"></i> </span> <span class="col-md-2"> <i class="fas fa-hospital cc_cursor" id="hospital-icon-jquery"></i> </span> <span class="col-md-2"> <i class="fas fa-user-md" id="doctor-icon-jquery"></i> </span> <span class="col-md-2"> <i class="far fa-calendar-alt"></i> </span> <span class="col-md-4"> <i class="far fa-calendar-check"></i> </span></div></div>' ).insertBefore( ".ea-standard" );
} );         
jQuery(函数($){
$(“.ea标准格式div.step”).not(“:eq(0)”.hide();
} );    
jQuery(函数($){
$(文档)。在('change','select[name=“location”]”上,函数(){
如果($(this.val()!=''){
$(“.ea标准格式div.step”).show();//全部显示
$(“.ea标准格式div.step”).not(“:eq(1)”).hide();//然后隐藏一些
$(“#位置图标jquery i”).removeClass(“当前图标黄色”).addClass(“活动图标绿色”);
$(“#医院图标jquery i”).addClass(“当前图标黄色”);
} } ) } );
jQuery(函数($){
$(文档)。在('change',选择[name=“service”]”,函数()上{
如果($(this.val()!=''){
$(“.ea标准格式div.step”).show();//全部显示
$(“.ea标准格式div.step”).not(“:eq(2)”.hide();//然后隐藏一些
$(“#医院图标jquery i”).removeClass(“当前图标黄色”).addClass(“活动图标绿色”);
$(“#医生图标jquery i”).addClass(“当前图标黄色”);
} } ) } );
jQuery(函数($){
$('').insertBefore(“.ea标准”);
} );         

我解决了。当我必须将医院图标放入span时,我注意到它在I中。所以,需要注意html代码

就是这样,

<span class="col-md-2"> <i class="fas fa-hospital cc_cursor" id="hospital-icon-jquery"></i> 

现在:


<span class="col-md-2" id="hospital-icon-jquery"> <i class="fas fa-hospital cc_cursor" ></i>