I am trying to set the input tag value from the javascript object passed to it.
Assume item has these values item = ['item one', 'item two']
<input type="text"
name="choice"
val=<%= item[0] %>
data_id=<%= item[1] %>/>
I expect the output like this
<input type="text"
name="choice"
val="item one"
data_id="item two"/>
But the actual generated html is :
<input type="text"
name="choice"
val="item"
"one"
data_id="item" />
What is wrong with my code?
As per mu is too short
comments, I quoted the attributes in the template and it worked fine.
<input type="text"
name="choice"
val="<%= item[0] %>"
data_id="<%= item[1] %>"/>