How to remove element after pseudo-content with jQuery

Behseini

I am working on the following code. How can I remove the pseudo content after the .house on click event using jQuery?

$('.remove').on('click', function() {
  $('.house::after').css('display', 'none');
});
.house {
  position: absolute;
  right: 0px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 80px 80px 0;
  border-color: transparent red transparent transparent;
}

.house::after {
  position: absolute;
  content: "";
  width: 80px;
  height: 80px;
  background: url("http://i.imgur.com/nceI30v.png");
  background-repeat: no-repeat;
  background-position: 75% 40%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="house"></div>
<button class="remove">Remove Pseudo</button>

לבני מלכה

Try this code...

$('.remove').on('click', function() {
  $('.house').addClass('removing');
});
.house {
  position: absolute;
  right: 0px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 80px 80px 0;
  border-color: transparent red transparent transparent;
}

.house::after {
  position: absolute;
  content: "";
  width: 80px;
  height: 80px;
  background: url("http://i.imgur.com/nceI30v.png");
  background-repeat: no-repeat;
  background-position: 75% 40%;
}
.removing:after{
display:none
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="house"></div>
<button class="remove">Remove Pseudo</button>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Pseudo element content with JQuery

From Dev

Move content added with pseudo-element:after

From Dev

How to set the content property of an `after` pseudo-element to an attribute of a sibling form element

From Dev

JQuery select pseudo-element :after

From Dev

is it possible to animate and remove the pseudo content from a element..?

From Dev

is it possible to animate and remove the pseudo content from a element..?

From Dev

How to remove child element without losing the content using jquery?

From Java

Is there a way to use SVG as content in a pseudo element :before or :after

From Dev

Using the :after CSS pseudo-element without inserting content

From Dev

CSS centering content add by pseudo-element after

From Dev

How to Remove Content from DatePicker After If is disabled In Jquery

From Dev

How to dynamically alter the CSS of a pseudo element with JQuery?

From Dev

jQuery How to remove element

From Dev

Modify CSS of the :after pseudo-element using jQuery

From Dev

Modify CSS of the :after pseudo-element using jQuery

From Dev

jQuery Remove HTML element but leave the content

From Dev

Jquery remove element after creating it originally with jquery

From Java

What is the ::content/::slotted pseudo-element and how does it work?

From Dev

How do I style part of the pseudo element content: "..."

From Dev

How to inserted HTML tag from pseudo-element content:

From Dev

How to inserted HTML tag from pseudo-element content:

From Dev

disable touch on the pseudo content of an element

From Dev

How to remove underline in css for anchors pseudo element in IE

From Dev

how to remove an element from after()

From Dev

How to remove a element after animation?

From Dev

How to remove after fadeOut of element?

From Dev

how to remove an element from after()

From Dev

JQuery animate element height after changing content

From Dev

How to position an ':after' pseudo-element at end of its owner?

Related Related

  1. 1

    Pseudo element content with JQuery

  2. 2

    Move content added with pseudo-element:after

  3. 3

    How to set the content property of an `after` pseudo-element to an attribute of a sibling form element

  4. 4

    JQuery select pseudo-element :after

  5. 5

    is it possible to animate and remove the pseudo content from a element..?

  6. 6

    is it possible to animate and remove the pseudo content from a element..?

  7. 7

    How to remove child element without losing the content using jquery?

  8. 8

    Is there a way to use SVG as content in a pseudo element :before or :after

  9. 9

    Using the :after CSS pseudo-element without inserting content

  10. 10

    CSS centering content add by pseudo-element after

  11. 11

    How to Remove Content from DatePicker After If is disabled In Jquery

  12. 12

    How to dynamically alter the CSS of a pseudo element with JQuery?

  13. 13

    jQuery How to remove element

  14. 14

    Modify CSS of the :after pseudo-element using jQuery

  15. 15

    Modify CSS of the :after pseudo-element using jQuery

  16. 16

    jQuery Remove HTML element but leave the content

  17. 17

    Jquery remove element after creating it originally with jquery

  18. 18

    What is the ::content/::slotted pseudo-element and how does it work?

  19. 19

    How do I style part of the pseudo element content: "..."

  20. 20

    How to inserted HTML tag from pseudo-element content:

  21. 21

    How to inserted HTML tag from pseudo-element content:

  22. 22

    disable touch on the pseudo content of an element

  23. 23

    How to remove underline in css for anchors pseudo element in IE

  24. 24

    how to remove an element from after()

  25. 25

    How to remove a element after animation?

  26. 26

    How to remove after fadeOut of element?

  27. 27

    how to remove an element from after()

  28. 28

    JQuery animate element height after changing content

  29. 29

    How to position an ':after' pseudo-element at end of its owner?

HotTag

Archive