This recipe shows you the different ways to enable and disable text controls in a form.
Copy the full code of this recipe from the code/05/text-controls
sources folder. This code can be launched using the URL http://localhost:8080/05/text-controls/main.html
.
In
main.html
, create the following text controls in a form:<form action='#' method='post'> <input type='search' id='searchitem' name='searchitem' autofocus placeholder='Enter search text' value='' /> <input type='text' id='textitem' name='textitem' placeholder='Enter text item' value='' /> <textarea id='textarea' name='textarea' placeholder='Enter description'></textarea> <a href='#' data-role='button' class='ui-disabled'>More Details</a> </form>
Add the following script to the
<head>
section to disable all controls:$('#main').live('pageinit', function(event) { $('#textitem').prop('disabled', true)...