when use $(audio).prev().html();
, logs:
<div class="col-md-8" style="background: #dddddd"></div>
however, when try css attributes using:
$(audio).prev().css("background")
it logs rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box
what doing wrong? how can get/set css attributes of element?
related html:
<div class="row"> <div style="background: #dddddd"> </div> </div> <audio id="soundb"> <source src=sounds/b.wav> </audio>
.prev()
returnprevious
element ,.html()
returninnerhtml
of matched element.
in case, statement, $(audio).prev().html();
return <div class="col-md-8" style="background: #dddddd"></div>
element $(audio).prev().css("background")
return css
property of parent of expected element <div class="row">
. element has no background style set, returning rgb(0, 0, 0)
try this: $(audio).prev().find('div').css("background")
also note: colors returned rgb
Comments
Post a Comment