Whenever I input an email address, it displays an error status.
I want the error status to appear after clicking the next button. In addition, I've included a "more view friends" link that, when clicked, will display one more textbox at each link.
Currently, the error status only shows up for the first 5 textboxes and does not work for other textboxes obtained by clicking the link.
However, in my jsfiddle link, the "invite more friends" link doesn't work, but on the webpage, it functions correctly.
Javascript:
$(document).ready(function() {
var container = $(document.createElement('div')).css({
padding: '5px',
margin: '0'
});
for (i = 0; i < 4; i++) {
$(container)
.append('<div><input type="text" class="input" id="tb' + i + '" placeholder="Email" /></div>');
}
$('#main').before(container);
$("input", container).keyup(function() {
validateEmail($(this));
});
var iCnt = 4;
function validateEmail(el) {
if (!isValidEmail($(el).val())) {
$(el).parent().addClass('invalid');
return false;
} else {
$(el).parent().removeClass('invalid');
return true;
}
}
});
var divValue, values = '';
function GetTextValue() {
$(divValue).empty();
$(divValue).remove();
values = '';
$('.input').each(function() {
divValue = $(document.createElement('div')).css({
padding:'5px',
width:'200px'
});
values += this.value.trim();
});
document.all.contact_list.value = values;
}
Can anyone help me identify my mistake and suggest how to fix it? Thank you in advance.