I know this is elementary stuff, but I just can’t figure it out…
How do I apply the css changes to multiple elements? At the moment, it’s only working for the first, but showing no errors.
function elemInit(){
var elem1 = jQ('#elem1');
var elem2 = jQ('#elem2');
jQ(elem1, elem2).each(function(){
jQ(this).css({
'margin-left': '-' + jQ(this).width()/2 + 'px'
});
});
};
elemInit();
jQ is to ensure there’s no conflict.
jQuery selectors work like CSS selectors, also
cssmethod useseachmethod internally, you can code: