uncalled function is breaking javascript on a page

The following function (which builds a list of options for a dropdown select box from an associative array of arrays arOpsOld) is only called when a button is pressed.  However, just having it in my code means that all the other javascript in my page doesn't respond at all.  If I comment this function out, everything else works fine.  This makes me think that I'm doing something silly with my formatting, but my brackets and semicolons all seem to line up.  I do use some of the same variable names in other functions, but if I understand variable scope correctly, that shouldn't matter.  Any ideas?

function opMakeMenuOld(vPlant, vMenuId) {
  var vOptIndex = 0;
  var vSelBoxId = document.getElementById(vMenuId);
  for ( OpId in arOpsOld ) {
    if arOpsOld[OpId][1] = vPlant {
      vSelBoxId.options[vOptIndex] = new Option(arOpsOld[OpId][0], arOpsOld[OpId]);
      vOptIndex++;
    }
  }  
}
LVL 4
RakafkavenAsked:
Who is Participating?
 
TimYatesCommented:
   if arOpsOld[OpId][1] = vPlant {

should be:

    if( arOpsOld[OpId][1] == vPlant ) {
0
 
TimYatesCommented:
because you missed the brackets, it would cause the whole bit of javascript to be unparseable, so nothing would run (as you said)

Tim
0
 
RakafkavenAuthor Commented:
That did the trick.  I feel dumb, but grateful!
0
 
TimYatesCommented:
Don't feel dumb!

We all do it now and then, and all you need is another set of eyes to look at it, and it all becomes apparent :-)

Good luck with it!

Tim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.