Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>+1 to Perchik, if you don't provide the definition of the functions you use, plus the html it's supposed to run on, we can't really help you to check your code.</p> <p>Anyway, I still see two things you can change. The first one is to initialize your arrays as arrays, and not as empty objects. You can't use the <code>push</code> method if your variable is not an array:</p> <pre><code>var tagHolder = new Array(); var availJobs = new Array(); </code></pre> <p>The second one is to use jQuery or any other javascript library that can make your life easier. In GreaseMonkey, you can use <code>@require</code> :</p> <pre><code>// ==UserScript== // @name Script Name // @namespace namespace // @include http://www.website.net/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js // ==/UserScript== </code></pre> <p>The <code>@required</code> scripts are retrieved <strong>when you add</strong> your script to GreaseMonkey: if you want to use that, you'll have to remove your script and reload it. GreaseMonkey will then keep a local copy of the <code>@required</code> scripts and load them when needed.</p> <p>With jQuery, your code would then look like that:</p> <pre><code>var jobs = {}; jobs.scan = function() { var tagHolder = new Array(); var availJobs = new Array(); $("#app8743457343_content b").each(function() { tagHolder.push(this); if ($(this).attr("color") == "silver") availJobs.push($(this).text()); }); return alert(availJobs[0]); } jobs.scan(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload