Hi, jQuery is undefined.
I think you need to import it somehow or use the jQuery from the web page. On Wednesday, 26 August 2020 at 23:44:48 UTC+2 sean.van....@gmail.com wrote: > Hi, > > I'm trying to make a script so that when something on eBay needs to be > sent first class, I get some kind of warning when viewing the address label > page. The relevant part of the HTML is this: > > <div class="buyer__info__items"><h3 > class="buyer_info__header"><span>Selected</span></h3><span > class="buyer_info__secondary buyer__paid-service">Royal Mail 2nd Class > Letter / Large Letter</span></div> > > I need to make it so that when it says "1st Class", I get a pop-up or the > background of that section flashes yellow or something. > > I found this on StackExchange: > var searcharea = jQuery('h2').parent('div').text(); var searchstring = > "superstring"; if( searcharea.indexOf( searchstring ) != -1 ) alert("exchange > alert to your own things"); > > If I change h2 to h3 and "superstring" to "1st Class", I figured I'd get a > warning but that doesn't work. Could anyone please tell me if they know > what I'm doing wrong? Thanks! > > The entire script is: > > // ==UserScript== > // @name eBay order first class postage alert > // @include https://gslblui.ebay.co.uk/gslblui/new_label?* > // @version 1 > // @grant none > // ==/UserScript== > var searcharea = jQuery('h3').parent('div').text(); > var searchstring = "1st Class"; > if( searcharea.indexOf( searchstring ) != -1 ) > alert("Send this item first class"); > > -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to greasemonkey-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/greasemonkey-users/8111aae1-fc80-4472-8e94-5e6992f17b04n%40googlegroups.com.