我需要在特定的div,class或id內顯示toastr消息。默認情況下它是正文。我發現我需要改變目標。但我似乎無法讓它工作。在特定div內顯示toastr
例如說我想這個div裏面顯示toastr:
<showerror> </showerror>
這是我使用的代碼:
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
};
$('#submitform').submit(function(e){
e.preventDefault();
console.log($('#ques1').val());
if($('#ques1').val()==null){
toastr.error('Please select a question', 'Error!');
}
});
任何人都可以請幫助。
你可以粘貼一些代碼的在這裏.. –
我加入jQuery代碼我用於顯示將toastr添加到主體右上角的toastr。但我希望它在我選擇的div或標記 –