Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy isn't page jQuery .focus event changing background-color style to green in Google Chrome after redirect?
    primarykey
    data
    text
    <p><strong>Goal:</strong></p> <p>Have first input box background-color change to green (on target.html) after redirecting. It works if you go to the link explicitly (type it into the URL bar) in Google Chrome.</p> <p>I'm using this version of Google Chrome: 13.0.782.112</p> <p>It's difficult to use jFiddle on this one, so I'll just give you the code using the Content Delivery Network (CDN) jQuery file to make it easier for you.</p> <p><strong>See this question for more details:</strong></p> <p><a href="https://stackoverflow.com/questions/6951587/why-doesnt-initial-page-focus-change-input-field-to-green-on-google-chrome">Why doesn&#39;t initial page focus change input field to Green on Google Chrome?</a></p> <p><strong>Source page:</strong><br /> <strong>(name this page as source.html)</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="./target.html"&gt;click this hyperlink in Google Chrome and see if the background-color changes to green on the first input field on target.html&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Target page:</strong><br /> <strong>(name this page as target.html and place in same folder as source.html file)</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function Change(obj, evt) { if (evt.type == "focus") { $(obj).css('border-color', '#000000'); $(obj).css('background-color', '#90EE90'); } else if (evt.type == "blur") { $(obj).css('border-color', '#FFFFFF'); $(obj).css('background-color', '#7AC5CD'); } } $(document).ready(function() { $("#Txt1").focus(); }); &lt;/script&gt; &lt;style type="text/css"&gt; .InputField { color: black; font-size: 12px; font-weight: bold; background-color: #7AC5CD; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;input id="Txt1" runat="server" class="InputField" onfocus="Change(this, event)" onblur="Change(this, event)" /&gt;&lt;br /&gt; &lt;input id="Txt2" runat="server" class="InputField" onfocus="Change(this, event)" onblur="Change(this, event)" /&gt;&lt;br /&gt; &lt;input id="Txt3" runat="server" class="InputField" onfocus="Change(this, event)" onblur="Change(this, event)" /&gt;&lt;br /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    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