html - Selecting id using jQuery on the fly -


using checkbox styling system here (with few slight modifications): http://blogs.digitss.com/javascript/jquery-javascript/jquery-fancy-custom-radio-and-checkbox/ have following jquery code:

if($(this).data("checked") == true) {     $("#" + this.id + "l").css("padding", "8px 0px 0px 0px");     $(this).css({backgroundposition:"center -"+(imgheight*3)+"px"}); } 

and html:

<div class="checkbox" id="c2">     <input type="checkbox" id="cbx2" name="num[]" value="2" /> </div> <div class="cbxlabel" id="c2l">opt 2</div> 

the part i'm having trouble $("#" + this.id + "l"). no matter try, doesn't select id of div "opt 2" properly. i'm trying style part of div can't seem right.

var $_this = $(this); $('#'+$_this.attr('id')+'1').css("padding", "8px 0px 0px 0px"); $_this.css({backgroundposition:"center -"+(imgheight*3)+"px"}); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -