Showing posts with label hack. Show all posts
Showing posts with label hack. Show all posts

Friday, April 8, 2011

Disable DIV with jQuery

Here's a lame trick I use to disable divs:
// this works on IE // disable $('#myDiv').attr('disabled', 'disabled'); // enable $('#myDiv').attr('disabled', '');

Disabling the whole div doesn't seem to disable inputs in chrome and firefox though, so here's the alternative version drilling down to each single input elements:
// this works everywhere but looks weird in IE // disable $('#myDiv :input').attr('disabled', 'disabled');  // enable $('#myDiv :input').attr('disabled', '');

Good hacking.