I tried to append an option value in a particular position/index using jquery.
This is my code :
function refreshDropDown(target,option){
var arrDatabases = getDatabases();
var numOfDatabases = arrDatabases.length;
var hasPe= jQuery.inArray("pe",arrDatabases) >=0 ;
var onlyPe= (jQuery.inArray("pe",arrDatabases) >=0 && numOfDatabases == 1);
if( !hasPe && !onlyPe && numOfDatabases !=0){
jQuery(".lookForSelector option[value='Publishers']").remove();
**jQuery(target).append(jQuery('<option> </option>').val('Publishers').html('Publisher'));**
}
}
In this above code i want to append the value "publishers" with caption "publisher" at 19th position. Now it is getting appended in the last index. the value for the variable target is ".lookForSelector".
Appreciate your timely help.