문제
이 코드가 있습니다.
$("div[id^='intCell']").mouseover(function() {
$(this).css({ "border:","1px solid #ff097c"});
}).mouseout(function() {
$(this).css({"border:","1px solid #000"});
})
그러나 나는 그것을 작동시킬 수 없다! HTML에는 PHP가 intcell_1, intcell_2 등의 ID를 갖기 위해 생성되는 DIV 목록이 있습니다.
해결책
CSS 객체 문자 그대로 구문이 올바르지 않습니다!
그것은해야한다:
$("div[id^='intCell']").mouseover(function() {
$(this).css({ "border": "1px solid #ff097c"}); // <-- This syntax was wrong
}).mouseout(function() {
$(this).css({"border": "1px solid #000"}); // <-- This syntax was wrong
})
작업 샘플 : http://jsbin.com/iyoba (편집 가능한 http://jsbin.com/iyoba/edit)
다른 팁
업데이트 :
"마우스 오버"및 마우스 아웃 대신 "호버"명령을 사용하고 속성 선택기의 별표를 사용할 수 있습니다.
예시:
$("div[id*='intCell']").hover(function() {
$(this).css({border:"1px solid #ff097c"});
},
function() {
$(this).css({border:"1px solid #000000"});
});
제휴하지 않습니다 StackOverflow