Alex Rivera | Logout

How to detect IE7 with javascript or jquery and add a class to div

Asked 2010-09-08T17:02:43.833
15

Is there any way to detect IE7?

I don't have any problems with my codes in IE8, but I have a problem with IE7.

So what I thought is that I can add a class with jquery when a browser is IE7 detecting it by javascript.

I want to change from

<div id="system">

to

<div id="system" class="ie7">

Thanks in advance.

Edit
Report

1 Answer

3

Try this:

<!--[if IE 7]>
<script type="text/javascript">
  $('#system').addClass('ie7');
</script>
<![endif]-->
answered 2010-09-08T17:09:08.587

Your Answer