Custom JavaScript function not defined

[VIEW TAG Custom Attributes]
["onclick" => "copyText(this);"]

RENDERS: <span onclick="copyText(this);">CLICK ME to copy and paste into INLINE-EDIT input text box</span>



[GLOBAL STARTUP SCRIPT]
function copyText(element) {
   document.forder_details1list.x1_myfield1_name.value = element.innerHTML;
}

In LIST page, when I enter INLINE-EDIT and in another textfield click on CLICK ME to copy… , nothing happens and console shows:Uncaught ReferenceError: copyText is not definedI would like the clicked text to be pasted into the INLINE-EDIT input field that I specified. What might be the problem?

You may read client side Global Code.