Answers for "hide an element css jquery"

1

jquery to hide a div

<div id="main"> 
  <p> Hide/show this div </p>
</div>

('#main').hide(); //to hide

// 2nd way, by injecting css using jquery
$("#main").css("display", "none");
Posted by: Guest on July-17-2020
0

show hide pseudo element jquery

<style>
    .search_box:after {
        content: 'foo';
    }
    .search_box.hidden:after {
        display: none;
    }
</style>
<script>
    //Instead of these 2 lines
    //$('.search_box:after').hide();
    //$('.search_box:after').css('display', 'none');

    //Use
    $('.search_box').addClass('hidden');
</script>
Posted by: Guest on December-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language