My goal is to dynamically generate a select element using JavaScript and include a custom attribute called data-placeholder
.
Is there a way to add non-standard attributes using JavaScript without triggering a browser error like:
Uncaught referenceError: Invalid left-hand side in assignment
The following code snippet is where the issue arises:
select1.data-placeholder="Choose ...";