2
What is the best way to write the following code, in Jquery?
document.getElementById("jogador").style.top = parseInt(document.getElementById("jogador").style.top) - v;
Since the beginning of the year I have been programming in Javascript, but only now I started with Jquery.
What is the reason for writing/doing this in jQuery? This native Javascript code does not work?
– Sergio
It works, but they recommended that I start using only Jquery...
– user75204
This recommendation may have false background. jQuery is done in Javascript and will do the same as this code does basically. If there is no specific reason then native JS is preferable. It may be that for stylistic reasons you do not want to mix JS with jQuery, but in general the less jQuery the better... take a look here: https://pt.stackoverflowcom/q/200809/129
– Sergio
Even so, how could I improve (shorten) the question code line?
– user75204