0

Am having a trouble with following code. The problem when adding the following style from jquery.

CSS

  .arrow_box {
position: absolute;
width: 24px;
border-radius: 30px 30px 3px 3px;
height: 17px;
float:left;
 }
.arrow_box:after {
border-color: rgba(136, 183, 213, 0);
border-top-color: #88b7d5;
border-width: 14px;
left: 0%;
 }

jQuery

<script type="text/javascript">
$(document).ready(function () {
    $('.arrow_box:after').css({
        "border-color": "red",
            "border-top-color": " #88b7d5",
            "border-width": "12px",
            "left": "0%"
    });
});
</script>

There will not have any jquery error but it is not working

2

3 Answers 3

2

You can't directly do this with jquery. But here solution with pure javascript http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/

Sign up to request clarification or add additional context in comments.

1 Comment

1

Pseudo elements are not DOM elements targetable with JavaScript.

1 Comment

is there a way to add this dynamically.?
1

Pseudo elements are not DOM elements so you can not access them using JavaScript or jQuery.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.