Hi,
I fear there might be a really easy answer to this but I just can't figure it out.
I want to retrieve a data- attribute from a li after the onclick has fired. How do I do this?
Thanks in advance,
Anton
I fear there might be a really easy answer to this but I just can't figure it out.
I want to retrieve a data- attribute from a li after the onclick has fired. How do I do this?
<
ul
id
=
"searchChoices"
class
=
"radioList"
>
<
li
class
=
"selected"
data-bind
=
"click: keyTypeChanged"
data-value
=
"0"
>Option 1</
li
>
<
li
data-bind
=
"click: keyTypeChanged"
data-value
=
"1"
>Option 2</
li
>
<
li
data-bind
=
"click: keyTypeChanged"
data-value
=
"2"
>Option 3</
li
>
<
li
data-bind
=
"click: keyTypeChanged"
data-value
=
"3"
>Option 4</
li
>
</
ul
>
var
searchViewModel = kendo.observable({
keyTypeChanged:
function
(e) {
//debugger;
alert($(
this
).attr(
"data-value"
));
}
});
Anton