Search code examples
javascriptjqueryjquery-textext

jQuery TextExt Plugin: KeyPress


I use TextExt, textext.plugin.tags.js

jQuery("#InputID").textext({ plugins: 'tags' }).keypress(function (event) {

                      //See if the key pressed is 'enter'
                      if (event.which == 13) {
                         alert("pressed key is enter");
                      });

but after press key enter, alert message not displaying

I want to catch keypress enter and KeyUp, some proposal?


Solution

  • Looking at the tags documentation, it appears that you want to use event enterKeyPress:

    http://textextjs.com/manual/textext.html

    I don't believe that textExt({plugin: 'tags'}) supports the keypress() method. Try this:

    jQuery("#InputID").textext({ plugins: 'tags' }).on({
        enterKeyPress: function(event) { alert('enter!'); }
    });