BACKGROUND: I need to copy the value of one field to another if a condition is met. This is what I have so far (just for testing/learning):
function copyOneTimeFactor(factor){
if (factor === "oneTimeFactorAmt1") {
alert("Called by " + factor + " rule. onetimeAmt1 = " + jQuery("#onetimeAmt1_cc2ba976-715e-44b1-a3e3-a2c6f5992382_$CurrencyField").val);
}
return(true);
}
I copied the input field id from Chrome Developer Tools (screen capture attached).
In testing the custom JS, I’m getting the message:
Syntax error, unrecognized expression: #onetimeAmt1_cc2ba976-715e-44b1-a3e3-a2c6f5992382_$CurrencyField
(screen capture attached)
If I remove the $, instead of an error message, I get 12 lines of unintelligible code as the (apparent) value of the input field (screen capture attached).
QUESTION: What is wrong with the way I’m referencing the field ID so that it constitutes a syntax error? Is there a better way to accomplish my goal than using jQuery to get/set the values of input form fields?
Thanks for any assistance!