2012-03-05 5 views
-1

div에 요소가 여러 개인 카드를 디자인하고 있습니다. jquery를 사용하여 div를 클릭하면 드롭 다운에서 글꼴 크기와 글꼴 패밀리를 변경하려고합니다. 어떤 도움을 주셔서 감사합니다.jquery를 사용하여 동일한 클래스의 여러 텍스트의 글꼴 크기 및 글꼴 모음을 변경하는 방법

+0

할 수 있습니다 실제 코드를 조금 통해하는 당신이 방법을 아이디어를 얻을 수 구현하려면 – Dips

답변

1
$('.class-name').css({ 
    'font-family': 'your, font, family', 
    'font-size': '16px' 
}); 
+0

나는이 같은 div가있다

name
phone
address
및 스크립트 $ (". drag_and_edit"). live ('select', function() { \t \t var id = $ (this) .attr ('id'); \t \t getfontsize (id); \t \t return true; \t}); 함수는 getfontsize (id) { \t \t $ ("# font-size") ("변경", 함수) { \t \t $ ("#"+ id) .css ("font-size", $ (this) .val() + "px"); \t \t});$ ("# font-family").); \t \t}); – Gautam

1

사용이, 예 :

$('some_element').click(function(){ 
    $('some_element').css({'font-size':'12px','font-family':'Arial'}); 
}); 
0
var elements=$("div.thisClass"); 
elements.each(function(i){ 
    $(this).css({'font-size':'3em', 'font-family':'Verdana'}); 
}); 
+2

'.each()'를 건너 뛰고'.css()'를 jQuery 객체에서 직접 호출 할 수 있습니다. – nnnnnn

+0

사실 +1. 그러나 .each는 div 안에 'each'요소에 다른 글꼴 스타일과 패밀리를 설정하려는 경우 유용 할 수 있습니다. – jmishra

관련 문제