Add $ to input
Automatically add a dollar sign to the input value if it doesn't contain it already.
by Jon Fuller
HTML
<form action="" method="get">
<input type="text" id="name" onblur="handleChange()"/>
</form>
JavaScript
function handleChange() {
var myValue = document.getElementById("name").value;
if (myValue.indexOf("$") != 0)
{
myValue = "$" + myValue;
}
document.getElementById("name").value = myValue;
}