Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You will need to do this when the DOM has loaded using jQuery's ready event for the document object. Here's a <a href="http://jsbin.com/oxiki/1" rel="nofollow noreferrer"><strong>Working Demo</strong></a></p> <pre><code>$(document).ready(function() { $('#tbox').removeAttr('readonly'); }); </code></pre> <p>or the shorthand</p> <pre><code>$(function() { $('#tbox').removeAttr('readonly'); }); </code></pre> <p><strong>EDIT:</strong></p> <p>I just read on <a href="https://stackoverflow.com/questions/919725/trigger-body-click-with-jquery/920265#920265">one of your other questions</a> how <code>$()</code> was not working but when you used <code>jQuery()</code>, your code worked. That indicates that there is a conflict with the <code>$</code> function, most likely due to another JavaScript framework being used on the page too that also uses the <code>$</code> shorthand. You can </p> <p>1- use jQuery's noConflict() to get around this. You can assign the jQuery selector function to a different alias.</p> <p>2- use<code>jQuery()</code> in your code in place of <code>$()</code></p> <p>3- wrap your jQuery code in a self-invoking anonymous function that will still allow you to use the <code>$()</code> shorthand for the jQuery selector inside of it</p> <pre><code>(function($) { $(function() { $('#tbox').removeAttr('readonly'); }); })(jQuery); </code></pre> <p>This is an anonymous function that takes one parameter, <code>$</code> and is executed immediately, passing in <code>jQuery</code> as the argument for that parameter.</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