Wednesday 15 February 2012

wordpress - What to do when jQuery isn't working? -


I am running a WordPress website. JQuery 1.8.3 is loaded from the wp-included directory.

I have written the most basic code jQuery code ...

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {warnings ("jQuery works !!");}); & Lt; / Script & gt;   

When the page loads, nothing happens. Therefore, I check the browser console ...

Depending on the page, I have seen:

Uncounted ReferrerArror: $ is not defined < / P

or

Uncort type error: Object object '$' [object object] is not a function

Indicates:

$ (document) .ready (function () {

How is it that jQuery functionality is not the easiest thing ... exactly? Am I doing something wrong?

I PHP is used for programming and on the other hand something is not working on the page the right error is occurring and it is usually very easy to detect and correct this error.

When such a situation arises, what is the usual debugging technique for jQuery?

How can I do this basic jQuery function with my WordPress website?

Any WordPress Plugins Not Enabled Apart from myself, I have a fresh blank topic, so there is no topic or plugin conflict.

WordPress call automatically, resulting in $ can not be available Are there.

Try it instead:

  jquery (document) .ready (function ($) {warning ("jquery works !!")}} ;   

Uses jQuery instead of $ in the global namespace, but redefined $ , allows you to use it as expected in the scope of document-ready functions.

This is not directly relevant to your problem, but this code can also be reduced, such as:

  jQuery (function ($) {warning ("jQuery's Works !!");});    

No comments:

Post a Comment