Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAshish Mehra
Courses Plus Student 73 PointsHow to target pseudo elements
hey all I have pseudo elements from where i am including ico-moon font in my html.
<div class="response">
<span class="error" data-icon =''>Something went wrong</span>
</div>
.error::before{
font-family: 'IcoMoon-Free';
content: attr(data-icon);
float: left;
cursor: pointer;
}
I want to hide response div when user click the ico-moon cross symbol ?
1 Answer
jag
18,266 PointsFrom what I've read you can't manipulate ::before or ::after. With that being said you will have to just use jQuery or pure javascript to hide error when clicked.
$('.error').click(function(){
$(this).css('color','red')
})
Matthew Francis
6,967 PointsMatthew Francis
6,967 PointsHi, I havent looked into jQuery syntax just yet, mind if you translate this to pure javascript?
jag
18,266 Pointsjag
18,266 Points