From 3553df0dc2fc9d9f641b6dbb29c28827cc18137f Mon Sep 17 00:00:00 2001 From: ninadsp Date: Mon, 7 Jun 2010 02:41:46 +0530 Subject: [PATCH] Refactored setSelectOptions with jQuery code --- js/functions.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/functions.js b/js/functions.js index 0ce6c72ff..1d3b74a69 100755 --- a/js/functions.js +++ b/js/functions.js @@ -1268,13 +1268,13 @@ function setCheckboxColumn(theCheckbox){ */ function setSelectOptions(the_form, the_select, do_check) { - var selectObject = document.forms[the_form].elements[the_select]; - var selectCount = selectObject.length; - - for (var i = 0; i < selectCount; i++) { - selectObject.options[i].selected = do_check; - } // end for + if( do_check ) { + $("form[name='"+ the_form +"']").find("select[name='"+the_select+"']").find("option").attr('selected', 'selected'); + } + else { + $("form[name='"+ the_form +"']").find("select[name="+the_select+"]").find("option").removeAttr('selected'); + } return true; } // end of the 'setSelectOptions()' function