0

I have a span that is generated every time a user focus out in the textbox. This span will contain emails so I want to validate every time a user enters an email. How can I apply a validation in jquery throught this span?

Below is my code

$('#tags input').on('focusout',function(){    
            var i = 0;
            var txt = $.trim( this.value );
            if(txt) {
                $(this).before('<span class="tag" id="">'+txt+'</span>');
            }
                this.value = "";
        });
Drenyl
  • 906
  • 1
  • 18
  • 41
  • 3
    ...by running the validation against `txt`? If you're looking for a validation function, one of these [**many** answers](http://stackoverflow.com/questions/46155/validate-email-address-in-javascript) may help you. – Obsidian Age Mar 01 '17 at 01:48
  • @ObsidianAge thanks dude, it fixed! – Drenyl Mar 01 '17 at 02:03

0 Answers0