Did build a function to return the index of element from a group of elements. But when I try to pass the value to another variable (myindex) I do get undefined.
Here the Javascript source code
$(document).ready(function(){
$("[id*='_CG']").addClass("form-control input-sm text-right");
$("[id*='_Weight']").addClass("form-control input-sm text-right");
$("[id*='TXFuelWeight']").addClass("form-control input-sm text-right");
$("[id*='TRPFuelWeight']").addClass("form-control input-sm text-right");
myindex = GetLSElementIndex("[id*='W_OP_']", "W_OP_CAB1Items");
alert (myindex);
});
// Get the index element in a group of element
function GetLSElementIndex(ElementGroup, Element) {
$(ElementGroup).each(function (index) {
var someText = $(this).attr('id');
if (someText == Element) {
alert(someText);
alert(index);
//GetLSElementIndex = index;
//alert(GetLSElementIndex);
return ;
//return index;
}
});
}