Aristain Aristain - 2 years ago 82
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 ?

Answer Source

you can write like this

var email="";
var domainName = 'www.' + email.split('@')[1]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download