html - Internet Explorer JavaScript - newline characters crashing script -
i have onclick event in javascript have chosen format below:
<a href="" onclick = " $('.white_content').html('<img src=\'/making.gif\'>'); $.ajax({ url: '/show_album.php?id=<?=$album['id']?>', type: 'get', success: function(data){ $('.white_content').html(data); }, error: function(){ alert('failed'); } }); return false;">
in firefox, fine, in internet explorer 8 script crashing because of way have layed out code in new lines instead onclick attribute.
does know way fix this? still developing page , others using similar code , keep clean layout opposed on 1 line.
if inspect onclick attribute in internet explorer developer tools find each line seperated several strange boxes assume represent unknown characters, in ie, causing error.
do following instead:
<script> function myonclick() { $('.white_content').html('<img src=\'/making.gif\'>'); $.ajax({ url: '/show_album.php?id=<?=$album['id']?>', type: 'get', success: function(data){ $('.white_content').html(data); }, error: function(){ alert('failed'); } }); return false; } </script> <a href="" onclick="return myonclick();">
Comments
Post a Comment