am using JSRender in my application.
<html>
<body>
{{for Comments}}
<input id="id_{{:CommentId}}" type="hidden" value="-1" />
<textarea id="cmt_{{:TopicId}}" ......... />
{{/for}}
</body>
</html>
<script type="text/javascript">
$(document).ready(function () {
//The below code gets executed / works fine.
$('#cmt_{{:TopicId}}').bind('keyup keydown paste', function (e) {
//my logic
});
//This code doesnot work fine, instead of -1, it gives undefined.
var rankAction = $("#id_{{:CommentId}}").val();
});
</script>
i want the rankAction
variable to give -1
, whereas it returns undefined
, why is it so?
Is it simply because id
containing JSRendered value within them cant be read in Script coding?
Then why is the other part i.e. cmt{{:TopicId}}
returning a value ?
Where is it wrong?