2013-02-22 5 views
0

내가 .html로에 삽입있어 개체의 패딩 변경하려고 해요 :변경 스타일의 호텔이

$('#notification-container').html($("<div id = 'notification-count'><span id = 'not-count'>"+ count +"</span></div>")); 
$('#notification-count').style.padding = 1px 4px; 

나는 그게 때문에 작동하지 않습니다 같은데요를 요소 #notification-count을 존재하지 않는 것으로 봅니다. 가능한 경우이 작업을 수행하는 가장 좋은 방법은 무엇입니까? 거기에 저장된 모든 .html embeddings와 함께 '마스터 배열'이 있습니까?

답변

0

변경

$('#notification-count').css('padding', '1px 4px'); 
1
당신이 JQuery와 .CSS를 사용할 수 있습니다

로 두 번째 줄() 메소드

$(function() { 
var count = 25; //default value for try 
$('#notification-container').html('<div id="notification-count"><span id="not-count">'+ count +'</span></div>'); 
$('#notification-count').css({'padding':'1px 4px'}); 
}); 
관련 문제