JQuery / Javascript not working in IE7

The following script does not work in IE7, but works fine in IE 8 + 9 and ALL other browsers. Even inclusion in alert("something"); not working - I have another script that works fine and works fine in IE 7.

 <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> 

Am I missing DOCTYPE? Here is the script below;

 var formPageTitle = $("div.hsRadarform td h3").text(); $('.AspNet-DataList td a').each(function (index) { var listElementText = $(this).text(); var shade = "faint"; if(formPageTitle.toLowerCase() == listElementText.toLowerCase()) { shade = "dark"; } //adding the numbered circles here using jQuery $(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)', 'background-repeat': 'no-repeat', 'height': '25px', 'width': '25px', }); }); 
+4
source share
1 answer

IE is very picky with commas:

 $(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)', 'background-repeat': 'no-repeat', 'height': '25px', 'width': '25px', }); 

Must be

 $(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)', 'background-repeat': 'no-repeat', 'height': '25px', 'width': '25px' // comma removed }); 
+14
source

Source: https://habr.com/ru/post/1384327/


All Articles