Reputation: 673
I really don't know that is kendo ui
support for this.
I wanna write a JQuery
function in the kendo ui
template
Here is the example
<script type="text/x-kendo-template" id="someId">
#
$(document).ready(function () {
$('#textfield1').attr('required');
});
#
<script>
the thing is the hash("#") mark gives me a error because kendo ui using hash mark to separate JavaScript and HTML in kendo UI. So how can I add hash mark in above example. Can some one help me ??
Upvotes: 0
Views: 4634
Reputation: 24738
You can use a backslash as an escape character:
<script id="javascriptTemplate" type="text/x-kendo-template">
<h4>#= $("\#theSpan").text() #</h4>
</script>
P.S. I don't think you need the document.ready as the KendoUI code (including templates) depends on jQuery and only runs after the document is ready.
Upvotes: 5
Reputation: 1520
You need to put every code line with the opening and closing #.
#$(document).ready(function () {#
#$('#textfield1').attr('required');#
#}); #
Source: http://demos.telerik.com/kendo-ui/templates/expressions
Upvotes: 1
Reputation: 2437
your syntax is incorrect ! here is correct one
here is the example too
http://demos.telerik.com/kendo-ui/templates/expressions
<script type="text/x-kendo-template" id="someId">
# $(document).ready(function () { #
# $('#textfield1').attr('required'); #
# });#
<script>
Upvotes: 1