i am using jsrender and i got issue on accessing value
{{for items}}
<input type="text" id="id1" value="{{*: Json.stringify(data)}}" />
{{/for}}
here i got value as: "{" id":"1","name":"johnny depp"}"
$("#id1").val() gives '{' all other values trimmed and
<input type="text" id="id1" value={{*: Json.stringify(data)}} />
here i get: "{id":"1","name":"johnny" depp"}
$("#id1").val() gives '{id":"1","name":"johnny'
the words after the space is getting trimmed how can i show full value
i have tried the solution as in <input value={{:abc}} /> does not seem to work properly in jsviews if the value of 'abc' has whitespace but still not working
Since the string returned from
stringify()includes double quotes", you need to instead use single quotes'for thevalue='...'on the markup for the input:which will give
Now
$("#id1").val()will give:'{"id":"1","name":"johnny depp"}'