나는 북마크처럼 작동하는 javascript 스크립트를하고 있습니다. 코드를 할당 한 후에 내가 가지고있는 div 중 하나를 클릭해야하지만 얻을 수는 없습니다.Click 쿼리가 작동하지 않습니다
JS 나는 그것이 작동에 마우스를 올려 두지 만 클릭으로 더 내가 쿼리를 사용하고
경우 : 내 HTML 코드에서
var $j = jQuery.noConflict();
$j('<div></div>').prependTo($j(this)).attr('id', 'shadow').css({
'height': '220px',
'width': '220px',
'background-color': 'black',
'position': 'absolute',
'top': 0,
'left': 0,
'opacity': 0.4,
'cursor': 'pointer'
}).click(function() { //this dons't work i try to put apart
//But if I put bind('mouseover' it works
alert('a');
//...more stuff
});
그것은 다음과 같이 얻을 :
<div id="div0" class="div" style="position: relative; ">
<div id="shadow" style="height: 220px; width: 220px; background-color: black; position: absolute; top: 0px; left: 0px; opacity: 0.4; cursor: pointer; "></div>
<img class="select" id="select0" src="url..." onclick="alert('aaa')">
<img src="url..." class="img" id="img0" height="62" width="220" style="margin-top:79px"></div>
</div>
은 내가 넣어 이미지에 직접 경고하고 작동하지 않습니다.
감사합니다.
"$ j (this)"의 j는 무엇을 의미합니까? –
@mesiesta var $ j = jQuery.noConflict(); – Edig
그게 문제가 아니 었습니다. 문제는 코드의 "스 니펫 (snippet)"이므로 "이것이"무엇인지를 보여주지 못합니다. 독립 실행 형 코드로서 아무 것도 아닙니다. –