Reputation: 677
So here I have a simple class / subclass that is in a style.css. I can't assign the element an id or define it in the CSS as an id using #. So no easy getElementById(). I need to change the "top" value to various sizes dynamically using javascript or jquery.
.slider-edit .bx-prev {
position: absolute;
top: 265px;
left: -32px;
width: 31px;
height: 31px;
text-indent: -999999px;
background: url(../images/icon_arrow_left.png) no-repeat 0 -31px;
}
I've searched the site and web, trying things like this with no luck.
$("slider-edit bx-prev").css("top","100px");
$(".slider-edit .bx-prev").css("top","100px");
document.getElementsByClassName('slider-edit bx-prev').style.top = "100px";
document.getElementsByClassName('.slider-edit .bx-prev').style.top = "100px";
Any help would be appreciated.
Upvotes: 2
Views: 3858
Reputation: 18848
this one is working fine:
$('.slider-edit .bx-prev').css("top", "100px");
Upvotes: 5