Is it possible to pass form elements by reference to function?
I want to create a function that changes form element’s text attribute (replaces some chars…) and I want to call it from different form elements.
here is the function (it replaces ‘~~’ to ‘\n’ in text strings):
function addLineBreaks(formElement) {
formElement.text.replace(/~~/gi, “\n”);
}
and I want to be able call it like this:
addLineBreaks($w(‘#text1’);
addLineBreaks($w(‘#text2’);
etc…
and that $w(‘#text1’).text & $w(‘#text2’).text in this example will be changed accordignly.
it’s not working that way.
What is the correct way do it?
thanks,
Gal