Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Js drop down working on one page but not another? WordPress


Hello we added a dropdown box to our site to show the newsletter signup. It shows fine on the homepage and a few other pages but not on the single blog pages.

I'm thinking this might be a conflict of javascripts. Could someone advise on what is happening and how to fix it?

URL of working page and non working page is on screenshot attached.

Thank you

Answers (4)


Arnav Joy answers:

i think you have some problem in common.js in the function drawLine();


Dbranes answers:

You have to add

<div class="oline">
<canvas id="mycanvas"></canvas>

to this page, otherwise you get a javascript error.

On the <strong>/portfolio/</strong> page, where it is working you have:

<div class="title container">
<div class="row">
<div class="twelvecol">
<h1 class='text'>Portfolio</h1>

<div class="oline">
<canvas id="mycanvas"></canvas>

The problem is in the <em>common.js</em> file just as @Arnav mentioned above, there you have

var canvas = document.getElementById('mycanvas');

and when there is no #mycanvas you get a javascript error when you later try to call

if (canvas.getContext) {


You could also modify <em>common.js</em> by replacing

if (canvas.getContext) {


if ( typeof(canvas.getContext) !== 'undefined' && canvas.getContext) {



Dava Gordon answers:

do you have a link to the site



In order to set up a drop-down menu to redirect to a new Web page, you need to add some simple JavaScript to your form.

First you need to set up your <option> tags to include the URL as the value - so that your form knows where to send the customer:

<option value="/">Web Design Front Page</option>
<option value="/library/beginning/bl_begin.htm">Beginning HTML</option>

Then you need to add an "onchange" attribute to your <select> tag to tell the browser what to do when the option list changes (put the JavaScript all on one line):

<select name="URL" onchange="window.location.href= this.form.URL.options[this.form.URL.selectedIndex].value">

Make sure that your select tag is named "URL" - if it isn't, change the JavaScript above where ever it says "URL" to read your select tag's name.