Jquery NOTY更新通知窗口中的输入或div?

时间:2017-08-07 13:40:33

标签: jquery noty

我正在显示带有消息的NOTY。我想更新显示的消息,因此noty会显示实时更新。

我已经尝试了这个并且noty有一个显示'TEST'的文本输入字段,但它永远不会更新说HELLO。

var n = noty({ type: 'information', layout: 'center', text: "<input id='msg' name='msg' value='TEST' />", 
dismissQueue: true, theme: 'relax', modal: true, maxVisible: 1 })

$('#msg').val('HELLO')

可以这样做吗? 感谢

1 个答案:

答案 0 :(得分:1)

来自documentation

new Noty({
   ...
   text: 'Some notification text',
   ...
 }).show();

摘录:

&#13;
&#13;
new Noty({
    type: 'information',
    layout: 'center',
    text: "<input id='msg' name='msg' value='TEST' />",
    dismissQueue: true,
    theme: 'relax',
    modal: true,
    maxVisible: 1
}).show();
$('#msg').val('HELLO')
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://rawgit.com/needim/noty/master/lib/noty.css">
<script src="https://rawgit.com/needim/noty/master/lib/noty.min.js"></script>
&#13;
&#13;
&#13;