Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery Validation Weird Behavior on Validating Dropdown List
    primarykey
    data
    text
    <p>I'm using jQuery validation to validate a dropdown list as follows:</p> <p>here is the javascript part:</p> <pre><code> $.ready(function(){ $.validator.addMethod("dropdown", function (value, element) { return validateDropDowns(this, value, element); }); $('#form1').validate({ onsubmit: false, focusInvalid: true, highlight: function (element, errorClass, validClass) { $(element).toggleClass('invalid'); $(element.form).find("label[for=" + element.id + "]").toggleClass(errorClass); }, unhighlight: function (element, errorClass, validClass) { $(element).toggleClass('invalid'); $(element.form).find("label[for=" + element.id + "]").toggleClass(errorClass); } }); }); function validateDropDowns(objContext, value, element) { return objContext.optional(element) || value != "-1"; } </code></pre> <p>and here is the markup part:</p> <pre><code>&lt;asp:DropDownList runat="server" ID="cmbGender" ClientIDMode="Static" meta:resourcekey="cmbGenderResource1"&gt; &lt;asp:ListItem Selected="True" Value="-1" Text="please select gender" meta:resourcekey="ListItemResource1"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="1" Text="male" meta:resourcekey="ListItemResource2"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="2" Text="female" meta:resourcekey="ListItemResource3"&gt;&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>I have a submit button and on its click I validate the form <code>return $("#form1").valid();</code></p> <p>now everything works fine in Chrome and Firefox but in IE9 I get a very weird behavior; the dropdown works fine before validation and after validating it. when you try to open the dropdown it will close immediately.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload