Greasy Fork is available in English.

게시판 » 개발

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.

댓글 남기기

댓글을 남기려면 로그인하세요.