Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Too much recursion in your code, doesn't that mean anything for you? Here's the improved code:</p> <pre><code>$(function() { $(".text").addClass("idleField").focus(function () { $(this).removeClass("idleField").addClass("focusField"); }).blur(function () { $(this).removeClass("focusField").addClass("idleField"); }); $("#recaptcha_response_field").attr("tabindex", "5"); /*@cc_on var $username = $("#username"); $username.watermark("Desired Username"); $("#password").watermark("Password between 6 and 12 characters"); $("#confirmPassword").watermark("Confirm Password"); $("#email").watermark("Please insert a valid email"); */ $("#checkUser").click(function () { $("#results").html("&lt;img src='images/loading.gif' alt='loading...' /&gt;loading...").load("library/regUserCheck.php", { name: $username.val() }); }); &lt;?php if ($error) { /* Make error fade out */ ?&gt; setTimeout(function () { $("#errorField").fadeOut(1250); }, 5000); &lt;?php } ?&gt; }); </code></pre> <p>Tips:</p> <ul> <li>You can use conditional comments (<code>/*@cc_on … */</code>) to handle IE, no need to do that with PHP.</li> <li>Never use a jQuery selector multiple times. jQuery needs to find that element in DOM multiple times. In most cases, you can use <strong>chaining</strong>, like this:</li> </ul> <pre><code>$('#el').click(function() { … }).addClass('myClass');</code></pre> <p>If you can't do that, <strong>cache</strong> it to a variable. Example:</p> <pre><code>var $el = $('#el'); $el.html('loading…'); setTimeout(function() { $el.load('/ajax/echo/html', {html: 'Hello, world!'}); }, 5000);</code></pre> <p>For example, if you want to specify more CSS rules for an element, this is the best syntax:</p> <pre><code>$('#el').css({ 'background-color': 'blue', color: 'white' });</code></pre> <ul> <li>This really depends on style and isn't important, but you can use <code>$(function() {</code> as a shorthand for <code>$(document).ready(function() {</code>.</li> </ul> <p>I hope that's enough. :)</p>
 

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