2012-10-26 6 views
2

예를 들어이 코드와 함께 jqueryui, dialog 플러그인을 사용합니다.여러 언어로 된 Jqueryui 대화 상자

$("#showUser-form").dialog(
        { 
         buttons: { 
          "OK": function() 
          { 
            $(this).dialog("close"); 
          }, 
          cancel: function() 
          { 
           $(this).dialog("close"); 
          } 
         }, 
         close: function() {} 
        }); 

다중 언어 웹 사이트와 같이 '취소'버튼의 텍스트를 변경하려면 어떻게해야합니까?

감사

휴고

답변

3

당신은 버튼을 포함하고 buttons 매개 변수를 전달하는 새로운 객체를 생성해야합니다. 그런 다음 동적으로 버튼 텍스트를 설정할 수 있습니다. 이처럼

jsFiddle Here

: 도움을

//You can dynamically change button text here 
var buttons = [,]; 
buttons['OK'] = 'OK :)'; 
buttons['Cancel'] = 'Cancel :('; 

var buttonArray = {}; 
buttonArray[buttons['OK']] = function() { 
    //Set OK function here 
    $(this).dialog('close'); 
}; 
buttonArray[buttons['Cancel']] = function() { 
    //Set Cancel function here 
    $(this).dialog('close'); 
}; 


$(function() { 
    $('#dialog').dialog({ 
     buttons: buttonArray 
    }); 
}); 
+0

감사합니다. 최대한 빨리 시도하고 결과를 알려 드리겠습니다. – Hugo

+0

Wonderful;) 고마워요. – Hugo

관련 문제