javascript - When I update a group-list in bs3 I lose the glyphicon -
here html
<div class="list-group"> <a href="#" id="lblchoice0" class="list-group-item">zero<i id="0" class="icon-volume-up icon-2x"></i></a> <a href="#" id="lblchoice1" class="list-group-item">one<i id="1" class="icon-volume-up icon-2x"></i></a> <a href="#" id="lblchoice2" class="list-group-item">two<i id="2" class="icon-volume-up icon-2x"></i></a> <a href="#" id="lblchoice3" class="list-group-item">three<i id="3" class="icon-volume-up icon-2x"></i></a> <a href="#" id="lblchoice4" class="list-group-item">four<i id="4" class="icon-volume-up icon-2x"></i></a> </div> i changing text of group-list js ajax read database following code:
$('#lblchoice0').html(msg.d[0]); $('#lblchoice1').html(msg.d[1]); $('#lblchoice2').html(msg.d[2]); $('#lblchoice3').html(msg.d[3]); $('#lblchoice4').html(msg.d[4]); how glyphicons stay?
try this:
$('#lblchoice0').html(msg.d[0] + '<i id="0" class="icon-volume-up icon-2x"></i>'); $('#lblchoice1').html(msg.d[1] + '<i id="1" class="icon-volume-up icon-2x"></i>'); $('#lblchoice2').html(msg.d[2] + '<i id="2" class="icon-volume-up icon-2x"></i>'); $('#lblchoice3').html(msg.d[3] + '<i id="3" class="icon-volume-up icon-2x"></i>'); $('#lblchoice4').html(msg.d[4] + '<i id="4" class="icon-volume-up icon-2x"></i>');
or (and better):
make html this:
<a href="#" id="lblchoice0" class="list-group-item"><span id="title_0">zero</span><i id="0" class="icon-volume-up icon-2x"></i></a>
then in jquery:
$('#title_0').html(msg.d[0]);
obviously same thing 5 rows.


Comments
Post a Comment