1

Topic: To receive the text . How?

To receive the text . How?
Morning.
There is a radiobutton wrapped in . On button cliques it is necessary to receive the text . The ready example on a site of the developer followed, but for me does not work. Takes off here on this line "var category = $ (item) [0].labels [0].innerText;"
Error: Unable to get property ' 0 ' of undefined or null reference
I generally badly read this code. Perhaps who explains - that it and why takes off at me. On a site of the developer all works. And I made a demo one in one.
https://docs.telerik.com/kendo-ui/knowl … tom-editor
[spoiler]

function templateFunction (dataItem) {
var cell = "";
var category = dataItem. CategoryID - 1;
for (var i = 0; i <categories.length; i ++) {
var item = "";
item + = "<label>"
if (category === i) {
item + = "<input type ='radio ' name = '" + dataItem.uid + "' onclick ='setDataItem (this); ' checked=checked/>";
} else {
item + = "<input type ='radio ' name = '" + dataItem.uid + "' onclick ='setDataItem (this); '/>";
}
item + = categories [i].text;
item + = "</label>"
item + = "</br>";
cell + = item;
}
return cell;
};
function setDataItem (item) {
var grid = $ ("#grid").data ("kendoGrid");
var row = $ (item).closest ("tr");
var dataItem = grid.dataItem (row);
>>> var category = $ (item) [0].labels [0].innerText; <<<
var ID;
for (var i = 0; i <categories.length; i ++) {
if (categories [i].text === category) {
ID = i;
break;
}
};
dataItem.set ("CategoryID", ID + 1);
};

[/spoiler]