CRM 2011 JS: Get OptionSet attribute value and text in CRM 2011

//This is how to Get OptionSet attribute value and text  in CRM 2011

var optionset = Xrm.Page.getAttribute("attributename");

Get Optionset Text
var text = optionset.getText();

Get Optionset Value
var value = optionset.getValue();