jquery Cannot call method 'click' of null > IT Note

본문 바로가기
사이트 내 전체검색

IT Note

jquery Cannot call method 'click' of null
0

View 12,377  | 작성일2012.07.26 16:59

본문

그누보드에 간단한 jquery 코드를 집어넣다 문제가 발생했습니다.

일반적인 페이지에서는 전부 사용 가능한 코드였으나 이상하게 write.php 에서는 먹히지 않더라고요.

이런 코드였습니다.

 $(document).ready(function(){
 $("#sfqclick dt").click(function(){
 $(this).toggleClass("bottomIco")
   .next().slideToggle(300)
   .siblings("dd").slideUp("slow");
 $(this).siblings("dt").removeClass("bottomIco");

문제없이 잘 돌아가는 코드이나 

write.php 에서는 다른 자바스크립트 코드때문에 충돌이 나는가 봅니다.

jquery Cannot call method 'click' of null 이런 문구와 함께 동작하지 않더군요.

결국 해결했습니다.

'$' 를 jQuery 로 수정하시면 됩니다. 

  jQuery(document).ready(function(){
 jQuery("#sfqclick dt").click(function(){
 jQuery(this).toggleClass("bottomIco")
   .next().slideToggle(300)
   .siblings("dd").slideUp("slow");
 jQuery(this).siblings("dt").removeClass("bottomIco");

요로니까 그누보드의 write.php 에서도 잘 작동하더군요^^

근데 왜 이런건 한국어 사이트에는 없는겁니까 -_-+


댓글목록

등록된 댓글이 없습니다.

IT Tip&Tech 목록

게시물 검색

접속자집계

오늘
362
어제
383
최대
6,399
전체
655,281
Copyright © LittleCandle All rights reserved.
문의메일 : littlecandle99@gmail.com
모바일 버전으로 보기