arrays - jQuery each call to other function -
i curious why not work. more hypothetical did run issue on site doing. trying avoid jquery function inside function. selector window instead of each of boxes.
edit*** understand how doing $(".box").each(function(){ // code here }); not sloppy or bad practice functions inside of functions?
css
.box { height: 50px; width: 50px; background: green; margin-bottom: 5px; }
html
<div class="box"></div> <div class="box"></div> <div class="box"></div>
javascript
function changeme(obj) { console.log(obj); $(obj).css("background", "blue"); } $.each($(".box"), changeme(this));
second each paramater must function - not function result:
$(".box").each(changeme); function changeme(n, obj) { ........
Comments
Post a Comment