Skip to content Skip to sidebar Skip to footer

How To Add Value In A Text Area From A Textbox?

I have an html page in which I have a textbox (Type your text) in which I need to type in text like this: Name=Value This textbox will be used by the user to quickly add Name Valu

Solution 1:

document.getElementById('add').onclick = addtext;

function addtext() {
    var nameValue = document.getElementById('my-text-box').value;
    if (/^([a-zA-Z0-9]+=[a-zA-Z0-9]+)$/.test(nameValue))
        document.getElementById('output').textContent += nameValue + '\n';
    else
        alert('Bad value.');
}

JSFiddle


Post a Comment for "How To Add Value In A Text Area From A Textbox?"