I have a mailer script in which I paste a list of email addresses in the input field (comma delimited) and based on those addresses the email subject is generated. Subject, in this case, should be the domain of the first recipient in the comma-delimited list.
So, basically, what should happen is that jQuery should take a list of comma-separated email addresses, capitalize the domain of the first email inputted, and put it into another input field.
But I am stuck since I'm not sure how to use split with 2 params and plus capitalize that.
My code currently outputs stackoverflow.com, anothermail
instead of Stackoverflow.com
.
$(function () {
var $src = $('#to'),
$dst = $('#subject');
$src.on('input', function () {
$dst.val($src.val().split("@")[1]);
});
});
Thanks a lot for anyone's help.