Search code examples
jquerynoty

Jquery NOTY update input or div in notification window?


I'm displaying a NOTY with a message in it. I'd like to update the message shown, so the noty shows live updates.

I've tried this and the noty has a text input field with 'TEST' shown, but it never updates to say 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')

Can this be done ? Thanks


Solution

  • From the documentation:

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

    The snippet:

    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')
    <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>