I have used the following piece of code to set defailt value of a DropDownn List in Sharepoint List form
for ( var i = 0; i < getField('select','County').options.length; i++ ) {
if ( getField('select','County').options[i].text == "New County" ) {
getField('select','County').options[i].selected = true;
}
}
The loop works fine on all other browser except IE8, how can i solve this issue
i get the error in IE8 as:
options is null or not an object
EDIT:
function getField(fieldType,fieldTitle)
{
var docTags = document.getElementsByTagName(fieldType);
for (var i=0; i < docTags.length; i++)
{
if (docTags[i].title == fieldTitle)
{
return docTags[i];
}
}
}