Javascript + WordPress = ARRRRRRGH
Well, at least I figured it out.
It seemed simple, worked fine as a regular web page. I was working on a customer’s “simple” WP blog when I ran into a problem. He is using the Blog for his newest product the Turbo Tee. He has four Paypal Buy-It-Now buttons which need to have a custom field sent with the order. We did not want to have the same input box for each button, so I got to ‘js’ a solution. Grabbed a sample of code, hacked at it a little and it worked right away. Then came WordPress.
When I put the code for the 4 forms with js into the WP “page” it would not function. Looking into why… seems WP formats everything. Got the solution to the formatting HERE. Although WP now would leave my code alone, it still would not render right with the code nor perform the desired js.
It seems there was some issue with a very benign looking item –> #>. This was at the end of the Paypal button code “— #>”. I had to make sure it ended up on the same last line as the encrypted button code and viola everything worked.
Now then, I am afraid to open it up in other browsers, afraid I’ll find I have to create css for each individual browser.
Discussion Area - Leave a Comment