JQuery Templates: pass html parameter into a function -
i have jquery template:
$.tmpl('<p>${text}</p>', { text: 'cool text' }).appendto('div');
works great. want pass html parameter it, following won't work.
$.tmpl('<p>${text}</p>', { text: '<span>cool text</span>' }).appendto('div');
any suggestions?
you can use {{html content}}
construct
$.tmpl('<p>{{html text}}</p>', { text: '<span>cool text <b>bold</b></span>' }).appendto('div');
span { color: red; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script> <div></div>
Comments
Post a Comment