boogyman
07-03-2008, 01:36 PM
How do I use anonymous functions to create an input field that converts the value into uppercase onblur()?
research the .toUpperCase() function
var a = "this is some text";
a.toUpperCase()
/* will give you -- THIS IS SOME TEXT */
to take that and make a function to use in a script
function convertToUpper(str, el)
{
document.getElementById(el).value = str.toUpperCase();
}
<input type="text" name="_something_" id="_id_" value="" onblur="javascript:convertToUpper(this.value, '_id_')">
research the .toUpperCase() function
var a = "this is some text";
a.toUpperCase()
/* will give you -- THIS IS SOME TEXT */
to take that and make a function to use in a script
function convertToUpper(str, el)
{
document.getElementById(el).value = str.toUpperCase();
}
<input type="text" name="_something_" id="_id_" value="" onblur="javascript:convertToUpper(this.value, '_id_')">