0

I am using JQuery Chosen plugin in an ASP user control which is dynamically created. It is working in firefox but not in IE8.

I have inculded following styles and scripts in master page,

<link rel="stylesheet" href="jquery-ui-1.8.18.custom/css/dark-hive/jquery-ui-1.8.18.custom.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="css/QMStyles.css" />
<link rel="stylesheet" href="css/screen.css" type="text/css" />
<link rel="Stylesheet" href="css/jquery.alerts.css" />
<link rel="Stylesheet" href="css/jquery.qtip.min.css" />
<link rel="Stylesheet" href="css/ui.spinner.css" />
<link rel="Stylesheet" href="css/jquery.contextMenu.css" />
<link rel="stylesheet" href="css/chosen.css" />

<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>

<script type="text/javascript" src="js/jquery.alerts.js"></script>

<script type="text/javascript" src="js/jquery.scrollTo.js"></script>

<script type="text/javascript" src="js/jquery.qtip.min.js"></script>

<script type="text/javascript" src="js/ui.spinner.min.js"></script>

<script type="text/javascript" src="js/chosen.jquery.min.js"></script>

The select option is looking like this on viewing source

<select name="ctl00$ContentPlaceHolder1$ctl00$ddlMType" id="ctl00_ContentPlaceHolder1_ctl00_ddlMType">
    <option value="1">value1</option>
    <option value="2">value2</option>
    <option value="3">value3</option>
    <option value="4">value4</option>
    <option value="5">value5</option>
    <option value="6">value6</option>
    <option value="7">value7</option>

</select>

This is how im using chosen

 $(function() {
     $('#ctl00_ContentPlaceHolder1_ctl00_ddlMType').chosen().change(function(e, a) {
         $('#ctl00_ContentPlaceHolder1_ctl00_selectedMList').val($(e.target).val());
     });
});
Sudhir Bastakoti
  • 94,682
  • 14
  • 145
  • 149
Rajneesh
  • 1,815
  • 4
  • 17
  • 28
  • When you say not working, can you say what error did you get ? if you do not get any error then jQuery probably did not find some element - or did not trigger some event. – Aristos Jan 01 '13 at 11:53

1 Answers1

0

Are you working in an Intranet environment?

IE8 will run in compatibility mode in that situation, and Chosen will not work.

I ran into this same situation, and This Answer helped me out.

I was using MVC 4, but something similar may work for you. Add this to your Web.config

<system.webServer>
 <httpProtocol>
   <customHeaders>
     <clear />
     <add name="X-UA-Compatible" value="IE=edge" />
   </customHeaders>
 </httpProtocol>
<system.webServer>
Community
  • 1
  • 1
Ben Truby
  • 1,357
  • 10
  • 13