+ 2

How can one define $ in jQuery?

I still don't understand why some my jquery code are not working and yet others are working. I used the same criteria but parts of the code is responding and the errors and warnings indicates that $ is used before it's defined. need help on this.

5th Nov 2018, 3:50 AM
Joeyoung K
Joeyoung K - avatar
1 ответ
+ 2
Most likely the Javascript is loading before your jquery script. wrap it in onload event like below window.onload = function(){ //my jquery code $('#txt').html = 'some text' } // onload end
5th Nov 2018, 4:01 AM
Lord Krishna
Lord Krishna - avatar