Skip to content Skip to sidebar Skip to footer

Jquery Html() Doesn't Work Well In Ie9

I use jquery to request data and then fill them to a table whose id is 'mresholder', it works in webkit and ff but it doesn't work well in IE. It will append those data behind <

Solution 1:

"sid", "aid" aren't valid HTML attributes. Try data-sid, data-aid

also, change

 o=$('#mresholder').html();
 $('#mresholder').html(o+='<trsid='+song.song_id+'aid='+song.album_id+'><tdclass="sname">'+song.song_name+'</td><tdclass="sartist">'+song.artist_name+'</td><tdclass="salbum">'+song.album_name+'</td></tr>');

to

$('#mresholder').append('<trdata-sid='+song.song_id+'data-aid='+song.album_id+'><tdclass="sname">'+song.song_name+'</td><tdclass="sartist">'+song.artist_name+'</td><tdclass="salbum">'+song.album_name+'</td></tr>');

(.html() to .append())

Solution 2:

Try using append instead.

$('#mresholder').append('<tr sid='+song.song_id+' aid='+song.album_id+'>'...);

Also, check the HTML that you're adding, IE has a problem when adding HTML to a table if it's not valid. Try @genesis' suggestion, and change sid and aid to data-sid and data-aid, too.

Post a Comment for "Jquery Html() Doesn't Work Well In Ie9"