Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery .click() works in Firebug, but not a Greasemonkey script?
    text
    copied!<p>I am attempting to write my first userscript using Greasemonkey, in Firefox. I have done a good bit of research because I am new to userscripts and jQuery but I can't seem to get this simple test script to work. So far I have this in the <code>Test.user.js</code> file:</p> <pre><code>// ==UserScript // @name Desk Notifications // @description Displays special notifications to NVOWS coaches at desk.com // @downloadURL http://www.example.com/deskNotifications.user.js // @include http://nvows.desk.com/agent // @namespace http://www.example.com/userscripts // @updateURL http://www.example.com/deskNotifications.meta.js // @version 0.1 // @grant none // ==/UserScript $(document).ready(function(){ alert('Script loaded.'); $('.interaction_type_60').click(function() { alert("You clicked a case!"); }); $('.interaction_type_40').click(function() { alert("You clicked a case!"); }); }); </code></pre> <p><br> What I need it to do is obviously a lot more complicated but because I am new to jQuery and userscripts I just wanted to make this work first. So far the "Script Loaded." is being displayed so that rules out a lot of possible problems. When I run only this part of the code in firebug it works fine:</p> <pre><code>$(document).ready(function(){ alert('Script loaded.'); $('.interaction_type_60').click(function() { alert("You clicked a case!"); }); $('.interaction_type_40').click(function() { alert("You clicked a case!"); }); }); </code></pre> <p>So that rules out having code errors or grabbing a wrong class selector. I can't see what could be the issue if the code is right and it is being executed. If anyone could help that would be greatly appreciated. I am not a newbie to programming. Just web based stuff.<br><br>Here is the part of the HTML page that I am trying to see when it is clicked.<br></p> <pre><code>&lt;tbody id="ticket_filter_list_items" class=" "&gt; &lt;tr id="ticket_filter_item_73354627" class="ticket_filter_item ticket_filter_item_table_view interaction_type_60 ticket_filter_item_open ticket_filter_item_current_selected" onclick=" ticketEditTableView(73354627, event);return false; " data-in-search="" data-ticket-id="73354627" style=""&gt; &lt;tr id="ticket_filter_item_73382205" class="ticket_filter_item ticket_filter_item_table_view interaction_type_40 ticket_filter_item_open " onclick=" ticketEditTableView(73382205, event);return false; " data-in-search="" data-ticket-id="73382205" style=""&gt; &lt;/tbody&gt; </code></pre> <p><br><br><i>This is off topic and not a big deal but if you see something that would make this userscript execute on pages that aren't 'http://nvows.desk.com/agent' then let me know. It says "Script loaded." every time I go to Stack Overflow. Ha.</i><br><br> <b>--------------------------------------<br><br> UPDATE:</b> I just tried to do this for testing: </p> <pre><code>$(document) .on('click', this, function(){ alert('Please Work!!!!'); }) </code></pre> <p>The things that I have been trying to click this whole time are the things that are not displaying the message. All of them are loaded with javascript after the page is loaded. I am almost positive that is the reason they will not allow me to click them. Is there a way to click these items. In the HTML script they look the same as the other elements.</p>
 

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