jquery - Setting Id not working when iterating through -
var = 0; @foreach (var item in model) { <text> $('#jp_audio_' + i).attr("id", "#jp_audio_@item.id") i++; </text> }
i++ seems stop working. if i++ not there set #jp_audio_0
new id, need set of ids new value, not first one. ideas why?
html i++ (id's not being set new value);
<audio id="jp_audio_0" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/95"></audio> <audio id="jp_audio_1" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/96"></audio>
without i++ in code (first 1 being set working);
<audio id="#jp_audio_96" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/95"></audio> <audio id="jp_audio_1" preload="metadata" src="http://localhost:6060/music/streampublishedsongs/96"></audio>
try convert variables c#:
@{ int = 0; } @foreach (var item in model) { <text> $('#jp_audio_' + @i).attr("id", "#jp_audio_@item.id"); @{i++;} </text> }
Comments
Post a Comment