Home > Enterprise >  JQuery to hide container with no class or ID
JQuery to hide container with no class or ID

Time:01-19

I have a site with a container called 'afterpay-placement'. In certain situations I want to remove that container. But it is just

    <afterpay-placement etc. > 

and then closed with

    </afterpay-placement>

How do I select that container?

CodePudding user response:

More context on your code would be helpful to write this the proper way however this works.

$("afterpay-placement").hide();

https://jsfiddle.net/6xm2k8ov/

CodePudding user response:

Another approach to hide afterpay-placement

 $(document).ready(function() {
        $("button").click(function() {
          $("afterpay-placement").css("display","none");
        });
      });
<!DOCTYPE html>
<html>

  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
   </head>

  <body>
    <afterpay-placement>Container to Hide.</afterpay-placement>

    <button>Click to Hide Container</button>

  </body>

</html>

  •  Tags:  
  • Related