2017-12-27 3 views
-1

방금 ​​j 쿼리를 배우기 시작했으며 코드 펜에서 테스트하고 싶지만 의도 한 결과를 얻을 수 없습니다. https://codepen.io/Sunny143/pen/MrJqrM코드 펜에서 jQuery를 사용할 수 없습니다.

다음은,

<head><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1  /jquery.min.js"></script></head> 
<body> 
    <h1>Hello World!</h1> 
</body> 

아래는

$(document).ready(function(){ 
    $("h1").mouseOver(function(){ 
    alert("mouseover the heading"); 
    }); 
}); 

이 하나 제발 도와주세요 내 J 쿼리 코드 내 HTML 코드 사전에 너무 감사드립니다.

편집 : 나는 내 질문이 명확했기 때문에 위에서 주어진 코드 펜 링크의 코드를 변경, 그래서

+0

는 당신이 얻을 기대하고 있음을 시도하고 당신은 무엇을 얻었 는가? –

답변

1

코드에서 구문 오류가 있습니다. mouseOver 대신 mouseover을 사용하십시오.

$(document).ready(function(){ 
    $("h1").mouseOver(function(){ 
    alert("mouseover the heading"); 
    }); 
}); 

에 : 그래서 단지에서 코드를 대체

$(document).ready(function(){ 
    $("h1").mouseover(function(){ 
    alert("mouseover the heading"); 
    }); 
}); 
+0

정말 고마워요. –

+0

좋아, 이제 내 대답을 받아 들일 수 있습니다. :) –

0

mouseovermouseOver을 변경 했습니까 링크를 참조하지만, jQuery를 같이 Codepen에서 잘 작동하지 마십시오 대신 당신이 당신의 펜의 설정을 사용하고 외부 자원을 추가 할 수 있습니다 <head>에 적재 라이브러리로, 여기 https://codepen.io/anon/pen/NXdLVJ 또한

$(document).ready(function(){ 
    $("h1").mouseover(function(){ 
    alert("mouseover the heading"); 
    }); 
    }); 

본. 당신이 당신의 콘솔을 보면

Codepen settings JS

+1

아, 벌써 @Nasqash가 대답했습니다. 우리가 편집에 관한 질문 업데이트를 원한다면. – Darren

0

당신은 낙타 케이스를 사용할 수 없습니다.

.mouseover() 

을 시도하거나

$(document).ready(function(){ 
    $("button").on('mouseover',function(){ 
    $("h1").toggle(1000); 
    }); 
});