I'm using Kendo UI TextBoxFor such as:
@Html.Kendo().TextBoxFor(model => model.ID).HtmlAttributes(new { @class = "fixed-width" }).Name("ID")
but I am unable to fetch the value in javascript:
var id = ????
any help is appreciated, thanks.
A TextBox used with @(Html.Kendo().TextBox()
or @(Html.Kendo().TextBoxFor(m => m.Property)
is just a helper method to create an input field. You can use jquery to get all fields with $('.k-textbox')
.
You may also add an id to get specific text boxes:
@(Html.Kendo().TextBoxFor(m => m.Property)
.HtmlAttributes(new
{
id = "text-box-property-id"
})
)
To get the value on client side with Javascript you could use jquery.
$('#text-box-property-id').val()
you can retrieve the value this way using JQuery:
$('#ID').data('kendoTextBox').value();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With