I have this code which runs perfectly on jsFiddle. When I try to run that code on my self-hosted WordPress site, however, it will not run. (The code is exactly the same on my page, except that I added <script type="text/javascript" src="/files/jquery-1.8.3.min.js"></script> before the Javascript on the page.) The Javascript is directly in the Text tab of my page, JS first followed by the HTML. The form loads properly, but clicking the "Add Row" button does nothing.

I had this issue on another page on my site, but it was fixed by wrapping everything in

    // code

and using jQuery noConflict mode. I implemented that here (as you can see in the code), but it is not working.


As for me, in WP I always use jQuery instead noConflict mode, Try to run this code: http://jsfiddle.net/GKmvA/1/

  • I just tried that and it unfortunately did not work. – vaindil Dec 20 '12 at 2:54
  • could you post here what FireBug (or Chrome Inspector) said? Do you see eny error? Put <code>alert('It works');</code> before JS-code. Do you see alert after page refresh? – MaximOrlovsky Dec 20 '12 at 2:56
  • Sorry, I should've done that. I'll edit my original post, but it says Uncaught SyntaxError: Unexpected token < on line 175. Line 175 is var rows = 1;, but WordPress autoformats it to display a </p> after the line (so var rows = 1;</p>). After removing all of the whitespace and linking it as a .js file (instead of directly embedding), it now works. Thank you! – vaindil Dec 20 '12 at 3:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.