jQuery template getting data back from target
iam talking abt this jquery-template http://api.jquery.com/jQuery.template/
var data={/*json*/};
//complie templa开发者_Go百科te
jQuery.template('some_name', jQuery('#templateId').html());
//fill elm with id=target.
jQuery('#target').html(jQuery.tmpl('some_name', data));
My question is there any way to get data object back from target. Iam not looking for any strategies rather some inbuilt templating functionality.
The tmplItem functionality will do this for you: http://api.jquery.com/tmplitem/
you can do something like:
var myTmplItem = $("#target").tmplItem();
Then access it like:
myTmplItem.data
精彩评论