Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Issue in IE7 Only
    primarykey
    data
    text
    <p>I have an issue popping up in IE7 only where it will issue a <code>"Object doesn't support the property or method"</code> error when the <code>onChange</code> event for any select box with a class of <code>VariationSelect</code>. I've thus narrowed it down to the following:</p> <pre><code>$(".VariationSelect").change(function() { // a bunch of irrelevant code // get the index of this select var index = $('.VariationSelect').index($(this)); //this is the line throwing the error in IE7 //some code that returns a block of data in json formatting }); </code></pre> <p>My first thought was a section of code with <code>attr('disabled', 'disabled')</code> since I've previously had trouble with that in IE7 when removeAttr is also used, but even when I removed those lines, the error stayed the same and the line/char reference in the JS error (which is meaningless, of course) does not change. So do you see anything else in that code block that IE7 won't accept?</p> <p>Edit: the code is running after a select box is changed. The select box HTML looks like the following:</p> <pre><code>&lt;div class="DetailRow"&gt; &lt;div class="Label"&gt;Some Label:&lt;/div&gt; &lt;div class="Value"&gt; &lt;select name="variation[aNumberStartingAtOneAndIncrementingUpwards]" class="VariationSelect" id="VariationSelect" style="width: 180px;"&gt; &lt;option value=""&gt;-- Choose an option --&lt;/option&gt; {A bunch of options for this choice loaded by PHP} &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The quick and dirty way to do it, since I know that the name element will always have a number in it that is one greater than the index, is to grab the name from the element that changed with something like:</p> <pre><code> var index = $(this).attr('name'); index = index.replace('variation[',''); index = index.replace(']',''); index = (index*1)-1; </code></pre> <p>Is there a faster/better way to get the index?</p>
    singulars
    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.
 

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