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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -