JQuery.append () not working from .js file
I have the following line of code:
$('#text').append('<h2 style="color:white">afdghadfg</h2>');
If I embed this code inside a script tag in html, it works fine. However, if it is placed in a .js file, it does nothing.
Be aware that there are many other working javascript and jQuery codes in the .js file, only this line will not work.
There may be a context that you put it. Make sure that it is not wrapped in a function and directly executable file. Also check your JavaScript console (Firebug / CDT) to see if there are any errors.
Another thing to check is to execute it until the DOM is ready, but I cannot tell you without seeing more code.