Note that there are some explanatory texts on larger screens.

plurals
  1. POInternet Explorer ignores javascript onblur() and focus() commands
    primarykey
    data
    text
    <p>I have the following problem. I have a page with multiple forms on it. I need to modify the default tabindex settings of a few of the forms. If I use the tabindex HTML attribute then it breaks the "working" forms, so I'm using JQuery to catch blur() events and set focus() to the correct input elements.</p> <p>My HTML:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;Property Name: &lt;/td&gt; &lt;td&gt;&lt;input type="text" class="Text" id="property_name" name="property_name" /&gt;&lt;/td&gt; &lt;td width="50"&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;Site Contact: &lt;/td&gt; &lt;td valign="top" rowspan="3"&gt; &lt;textarea class="Default" id="site_contact" name="site_contact"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Address: &lt;/td&gt; &lt;td&gt; &lt;input type="text" class="Text" id="property_address" name="property_address" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;City: &lt;/td&gt; &lt;td&gt; &lt;input type="text" class="ShortText" id="property_city" name="property_city" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;State: &lt;/td&gt; &lt;td&gt; &lt;input type="text" class="ShortText" id="property_state" name="property_state" /&gt; &lt;/td&gt; &lt;td width="50"&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;Comments: &lt;/td&gt; &lt;td valign="top" rowspan="3"&gt; &lt;textarea class="Default" id="property_comments" name="property_comments"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Zip: &lt;/td&gt; &lt;td&gt; &lt;input type="text" class="ShortText" id="property_zip" name="property_zip" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Description: &lt;/td&gt; &lt;td&gt;&lt;?php Utilities::showPropertyDescriptionDdl('property_description', 'property_description'); ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt; &lt;input type="submit" class="submit" value="Save" id="SaveProperty" /&gt; &amp;nbsp; &lt;input type="button" class="simplemodal-close" value="Cancel" id="CancelProperty" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>My JQuery:</p> <pre><code>$('#PropertyForm [name=property_name]').blur( function() { $('#PropertyForm [name=property_address]').focus(); }); $('#PropertyForm [name=property_address]').blur( function() { $('#PropertyForm [name=property_city]').focus(); }); $('#PropertyForm [name=property_city]').blur( function() { $('#PropertyForm [name=property_state]').focus(); }); $('#PropertyForm [name=property_state]').blur( function() { $('#PropertyForm [name=property_zip]').focus(); }); $('#PropertyForm [name=property_zip]').blur( function() { $('#PropertyForm [name=property_description]').focus(); }); $('#PropertyForm [name=property_description]').blur( function() { $('#PropertyForm [name=site_contact]').focus(); }); $('#PropertyForm [name=site_contact]').blur( function() { $('#PropertyForm [name=property_comments]').focus(); }); </code></pre> <p><strong>What should be happening</strong>: When the property_name element loses focus, the property_address element should gain.</p> <p><strong>What is happening:</strong> When the property_name element loses focus, the site_contact element gains focus then immediate forwards the focus on to the property_comments element.</p> <p>This is happening in Internet Explorer 7 and 8. In FireFox everything works as expected. Is there something about having two elements "in a row" that have onblur events assigned, ie property_name and site_contact occur consecutively in the HTML.</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.
    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