I am trying to put a ternary operator inside an input element.The problem is that this causes the input element NOT to be printed in the browser.This is it:
As well, you also need to alter this section of code:
// before
+ show_pr_val.value==1 ? "checked":"";+
// after
+ (show_pr_val.value==1 ? "checked":"") +
The semicolon was prematurely ending the statement, and wrapping the ternary statement in parentheses will ensure that it’s the result of the expression that gets concatenated with the rest of the string.