Sunday, 15 June 2014

Using jQuery as a selector, working with JavaScript, is it possible? -



Using jQuery as a selector, working with JavaScript, is it possible? -

var helper, kitti, amount; if (i == 0) { helper = "#k" + ids+ " .contain"; } else { helper = "#k" + ids + " .d" + i; } kitti = "$(" + helper + ").get(0)"; amount = (mousex-kitti.width / 2) * layer[i - 1] * 2; kitti.style.transform = "rotatey(" + amount * 50 + "deg)"; kitti.style.left = amount + "px";

this part of code doesn't seem work but. bet did wrong selecting it? i've read couple of articles , came conclusion. not work, can explain me why? how can select classes jquery , after go on plain javascript?

you've made simple syntax errors here. don't care style in you're written code, best suggest prepare might be.

in sec line, write kitti = "$(" + helper + ").get(0)". problem here $ function defined in jquery library , treating string.

the result here assign string value variable kitti. appear using undefined variable ids in line 1. right syntax this:

var kitti = $(helper).get(0);

i don't want overbearing, syntax of code in question, might benefit reading book on javascript such "javascript: parts", douglas crockford. there lots of info available free on web site.

javascript jquery selector

No comments:

Post a Comment