jquery - Css of div with dynamic value of id? -
i have 2 or more sections on webpage. here taking 2 photo sections example. every section have given email icon link same class name "divclasss" different ids clicki6524 , clicki6525. every section have hidden div consecutively dclicki6524 , dclicki6525.
now want display these hidden div click on email icon link in particular section. able so. can these 2 section here.
some time work when give static div value #dclicki624 in below code css. dont want give static value because div id comming dynamically , can 2 or more. appreciated.
the jquery code using is:
$('.divclasss').click(function(){ var = 'd' + this.id; $("#a").css({"display":"block", "top":"10%", "position":"fixed", "background":"#333", "border-radius":"5px", "padding":"10px", "color":"#fff" }); });
you concatenating string wrongly,
$("#"+a)
and suggest class divclass
@ context since css
rules div
elements same.
simply in css like,
.divclasss{ display:block; top:10%; position:fixed; background:#333; border-radius:5px; padding:10px; color:#fff; }
Comments
Post a Comment