-4
나는 jquery를 사용하여 tampermonkey (chrome)에 스크립트를 작성하는 방법을 배우고 있습니다. 문제가 생겼습니다. GO 1을 클릭하고 GO 2를 클릭하십시오. 수업을 사용해 보았지만 나에게 효과가 없습니다.클래스를 사용하여 클릭하는 방법
이것은 웹 사이트의 코드 예제입니다.
<div class="location">
<a onclick="go_1.submit();" title="Go">
<form action="/place" method="post" name="go_1">
<input type="hidden" name="id" value="1">
</form>
<img src="img/location/s/Go 1.jpg" height="40" width="50" alt="Place" One="" border="0">
</a>
</div>
<div class="location">
<a onclick="go_2.submit();" title="Go 2">
<form action="/place" method="post" name="go_2">
<input type="hidden" name="id" value="2">
</form>
<img src="img/location/s/Go 2.jpg" height="40" width="50" alt="Place2" Two="" border="0">
</a>
</div>
나는이 기능을 사용하여 시도하지만하지 작동 :(
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://website.xx/xx
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// @run-at document-end
// ==/UserScript==
$(function(){
document.getElementsByClassName("go_1.submit")[0].click();
});
$(function(){
document.getElementsByClassName("go_2.submit")[0].click();
});
는하지만 난 아무것도 찾을 수 없습니다. 영어는 내 주요 언어가 미안하지 않다 실수로.
"작동하지 않음"은 문제에 대한 설명이 아닙니다. 질문을하고 [편집]하고 [mcve]를 제공하십시오. [브라우저 콘솔 (dev tools)] (https://webmasters.stackexchange.com/q/8525) ('Ctrl' +'Shift' +'J')를 치고 오류를 읽으십시오. 'go_1.submit'와'go_2.submit'는 클래스 이름이 아닙니다. – Xufox
* 작동하지 않습니다. * 문제의 설명이 아닙니다. [질문] 및 [mcve]를보고 게시물을 편집하여 * 작동하지 않는 것을 분명하게 설명하십시오. 문제가 무엇인지 분명하게 알려주고 특정 질문 *을하는 것이 귀하의 임무입니다. 당신은 전혀 문제를 설명하지 않았고 어떠한 질문도하지 않았습니다. –