Aristain Aristain - 5 months ago 8x
HTML Question

Copy Only Domain Name from email input

I have an input field for email input and URl input field. On double click i copy mail's value to url like this

function cp_mail() {
document.getElementById("mail").value = document.getElementById("Url").value;

Now i only want to copy domain name of email (from the "@" to the end) and insert on the begining of Url "www." .Any Ideas ?


you can write like this

var email="";
var domainName = 'www.' + email.split('@')[1]