javascript - Assign a dynamic string to the ID of an element -


i want assign dynamic string id of element. here's how input element is:

<input id = 'ac'+ @item.index /> 

notice, assigning 'ac' + @item.index

@item.index dynamic part, integer.

i can assign @item.index , works, however, when try combine string 'ac' @item.index, not work.

what doing wrong?

thank you.

try using explicit code nugget. wrap in brackets. you'll want quotes around attribute value.

try this

<input id="ac@(item.index)" /> 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -