开发者

jQuery template getting data back from target

开发者 https://www.devze.com 2023-02-21 04:30 出处:网络
iam talking abt this jquery-template http://api.jquery.com/jQuery.template/ var data={/*json*/}; //complie templa开发者_Go百科te

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
0

精彩评论

暂无评论...
验证码 换一张
取 消