wysiwyg logo Easy javascript with jquery

How to disable/enable an element with jQuery
Sometimes you need to disable or enable some elements
in your page, thats where jQuery makes this easy.
All you have to do is to set disabled attribute(attr) to "disabled".

Example:
// To disable 
$('.myElement').attr('disabled', 'disabled');

// To enable it
$('.myElement').removeAttr('disabled');

// OR you can set attr to "" 
$('.myElement').attr('disabled', '');

// To disable all checkboxs in page
$(":checkbox").attr('disabled', 'disabled');

// Same result different syntax
// To disable
$('.someElement').attr('disabled', true);
// To enable
$('.someElement').attr('disabled', false);

INPUT VALUE
$("#tm111").attr('value', '123');
// or 
$("#tm111").val('123');
 _---------------------------------------------------_

TOGGLE 
// $("#exshippingform").toggle(this.checked);
// $("#exshippingform").slideToggle("slow");
 
 _---------------------------------------------------_
SELECTEDINDEX 
// remove selected option 
$('#ExtraShipping').attr('selectedIndex', '-1');
// set selected option by using selectedIndex
$('#ExtraShipping').selectedIndex = 0;

 _---------------------------------------------------_
// change text content 
//$("#xxx1").text(mytext);

// change html content 
//$("#xxx1").html(mytext);	

 _---------------------------------------------------_
OPTION SELECTED VALUE
showextar = $("#Country option:selected").attr('value')

 _---------------------------------------------------_
checked 
var shipto = $('#sameshipping').attr('checked')




xnet 1998 - 2011