2017-05-05 1 views
1
var text += '<b>Hii This is Error<b>'; 
swal("Required", text, "error"); 

Bootstrap Sweet alert 플러그인에서 html 코딩을 사용하는 방법.달콤한 경고에 html 태그를 사용하는 방법

위의 코드에서 나는 에 대해 작성해야합니다. 오류 메시지!을 sweetalert에 표시하십시오. 하지만 텍스트 변수에 html 태그를 사용하는 경우에는 문자열을 취하고 같은 문자열을 html 태그로 변환 할 수없는 sweetalert에 표시 할 수 있습니다.

답변

0

당신은 같은 HTML 콘텐츠를 표시하기위한

swal({ 
    title: "Required", 
    text: "<b>Hii This is Error<b>", 
    html: true, // add this if you want to show HTML 
    type: "error" // type can be error/warning/success 
}); 

읽기 Sweetalert configurationhtml:true을 추가해야합니다.

+0

이 솔루션 –

+0

하면 작품에 대한 감사합니다 ... 시도해야합니다! 그런 다음 응답으로 표시하여 다른 SO 사용자를 도울 수 있습니다. –

0
swal({ 
title: "Required", 
text: "<b>Please fill the required fields</b>", 
html: true, 
type: "error" 
}); 
관련 문제