I have a function called FormatCurrency()
which I would like to call on each of the following elements:
TextBoxA
TextBoxB
TextBoxC
...
TextBoxN
My current function performs the following operation
function formatALL()
{
//get the value into var v. call FormatCurrency(v) and store it back
var v = document.getElementById("TextBoxA_TextBox").value;
document.getElementById("TextBoxA_TextBox").value = FormatCurrency(v);
v = document.getElementById("TextBoxB_TextBox").value;
document.getElementById("TextBoxB_TextBox").value = FormatCurrency(v);
v = document.getElementById("TextBoxC_TextBox").value;
document.getElementById("TextBoxC_TextBox").value = FormatCurrency(v);
//etc... all the way til my last TextBox
}
Is it possible to optimize this code? In other words, does anyone know any slick loops/operations/etc. to perform this same task?
Thanks!