चर्चा » विकास

Error in code. "contains"

§
पोस्ट केले: 2018-03-08
संपादित केले: 2018-03-08

Error in code. "contains"

document.location = document.querySelector("A.zmW.tdNone[href*='battle']:contains('LinkName')").href;
This code isnt work, but this work
document.location = document.querySelector("A.zmW.tdNone[href*='battle']").href;
how to use to work together with
:contains('LinkName')
where is the mistake? Tell me please. If that I'm a novice and do not understand much. Thank you in advance for your help!

woxxomनियामक
§
पोस्ट केले: 2018-03-08
संपादित केले: 2018-03-08

contains() is a jQuery selector so it doesn't work in standard DOM method like querySelector. You need to include jquery.js in your usercsript metablock (example) and switch to $ function:

location = $("A.zmW.tdNone[href*='battle']:contains('LinkName')").attr("href")
§
पोस्ट केले: 2018-03-08

Tell me, please, how to include jquery.js

woxxomनियामक
§
पोस्ट केले: 2018-03-08

See the linked example in my post above.

उत्तर पोस्ट करा

उत्तर पोस्ट करण्यासाठी साइन इन करा.