$(document).ready(function(){
$('.btn').click(function(){
var username = $('.username').val();
var password = $('.password').val();
var email = $('.email').val();
var tag = $('.tag').val();
var row = '<tr><td>'+ username + '</td>' + '<td>' + password + '</td>'+ '<td>' + email + '</td>' + '<td>' + tag + '</td>' +'</tr>';
if (username.length === 0 || password.length === 0 || email.length === 0 || tag.length === 0) {
alert('empty');
}else{
$('table').append(row);
$(':input').each(function(){
$(':input').val('');
});
}
});
});
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.