javascript - Weird jquery error when checking for email data in textarea -
okay have working example jsfiddle cannot work. used code yesterday , doesnt work.
the code should check duplicated emails , extract emails first textarea second.
the link jsfiddle working sample: http://jsfiddle.net/49fkexu9/
i'm using exact same code on website, says theres no emails in text.
can see error in code?
my website it: http://truelads.com/email-extractor/
my html code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <textarea id="email-extractor" class="email-extractor-textarea"></textarea> <textarea id="email-extracted" class="email-extractor-textarea"></textarea>
my jquery code:
function extractemails(text) { return text.match(/([a-za-z0-9._-]+@[a-za-z0-9._-]+\.[a-za-z0-9._-]+)/gi); } function eliminateduplicates(arr) { var i; var len = arr.length; var out = []; var obj = {}; (i = 0; < len; i++) { obj[arr[i]] = 0; } (i in obj) { out.push(i); } return out; } var emailsfulllist = []; $('#email-extractor').keyup(function (index) { var emails = extractemails($(this).val()); console.log(emails); if (!emails) { $('#email-extracted').val('no emails found in text'); } else if (emails.length < 2000) { var text = ''; (var = 0; < emails.length; i++) { text += emails[i] + ', '; } emailsfulllistcheck = emailsfulllist.concat(emails); emailsfulllistnone = eliminateduplicates(emailsfulllistcheck); $('#email-extracted').val(emailsfulllistnone); } else { $('#email-extracted').val('please allow max-limit of 2000 emails (' + emails.length + ').'); } });
you have section id email-extractor
, text area id email-extractor
. need change 1 of these make sure js lines 1 want target
Comments
Post a Comment