Hi,
In my page I have a checkBoxList and I need to select all items that has an specific word. Let's suppose my CBL is:
VB.NET
C#.NET
Java2SE
Java2EE
And suppose that I need to select only the items about .NET (the items that cointain the string ".NET"). How can I check (in Javascript) if current Item in the CheckBoxList contains the string I'm passing as parameter?
Right now my code is like this:
function checkSpecific(cbl, text) {
var chkBoxList = document.getElementById(cbl);
var chkBoxCount = chkBoxList.getElementsByTagName("input");
for (i = 0; i < chkBoxCount.length; i++) {
var currentItem = chkBoxCount[i].innerText
var expectedIndex = currentItem.length - text.length
if (currentItem.lastIndexOf(text) == expectedIndex) {
chkBoxCount[i].checked = true;
}
}
}
But the problem is that I'm not able to get the text of the currentItem (VB.NET, C#.NET, etc). Does anyone know how can I do it?
Thanks in advance,
Ana