Can you use jquery to add comments dynamically to code?

前端 未结 9 1478
无人共我
无人共我 2021-01-18 05:20

I tried:


but it didn

9条回答
  •  无人共我
    2021-01-18 06:08

    Some options:

    $('.mycurrentclass').remove(); 
    
    $('.mycurrentclass').detach();// see below for possible use
    
    $('.mycurrentclass').css({display:'none'});
    
    $('.mycurrentclass').hide(); 
    
    $('.mycurrentclass').toggleClass('myhiddenclass');
    
    $('.mycurrentclass').addClass("myhiddenclass");
    
    $("myselector").toggle(
      function () {
        $(this).addClass("myhiddenclass");
      },
      function () {
        $(this).removeClass("myhiddenclass");
      }
    );
    
    // programtic like you seem to want:(first part puts it back, else detaches it)
    var p;
    if ( p ) 
    {
      p.appendTo("mywheretoappenditselector");
      p = null;
    } 
    else 
    {
      p = $("myselector").detach();
    };
    

提交回复
热议问题