0
我是新來JsRender,請幫我下面的問題......如何使用JavaScript變量在Jsrender模板
我堅持一個愚蠢的問題,我已經花了很多時間,但無法找到一篇相關文章的幫助。
我的 我已經做了一個JavaScript變量(s_name),並希望在我的for循環中使用它作爲我單選按鈕的名稱。但我無法這樣做。請找到下面的代碼..需要你的幫助傢伙..
{{for Product}}
<div class="leftOptInner1 my_left_{{:Id}}" id="my_left_inneropt">
<div class="leftIconInner1 my_{{:Id}}" name="{{:Name}}" id="{{:Id}}" >
<!-- <div class="leftIcon1 designer_left_icon "> -->
<div class="designer_left_icon ">
<img src="{{:ImageSource}}" width="100%" height="100%">
</div>
<p >{{:Name}}</p>
<span class="name" id="{{:Id}}"></span>
{{:"<scr" + "ipt type="text/javascript">"}}
var s_name = "{{:Name}}";
alert(s_name);
// s_name.render();
{{:"</scr" + "ipt>"}}
</div>
<div class="rightIconOptOuter" style="width: 100% !important; float: left;">
{{for Options}}
{{for Features}}
<div class="rightIconOptInnerBox">
<div class="tick">
<div class="single_set_designer col-md-2">
<div class="fav-heart1 fav-heart_deisgner" id="{{:Id}}">
<span class="name" id="{{:Id}}"></span>
<div class="checkbox" id="{{:Id}}">
<label>
<input class="myChk designer_chk" type="checkbox" id="{{:Id}}" data-textronic_id="{{:Id}}" data-textronic_name="{{:Name}}" name="check[]" />
</label>
</div>
</div>
<div class="element_wrp text-center">
<img src="{{:ImageSource}}">
<p>{{:Name}}</p>
<div class="price_hide">
<a class="show_price" id="{{:Id}}"><i class="fa fa-inr" aria-hidden="true"></i> Add Cost</a>
<input class="cost_associated form-control text-center showdesign{{:Id}}" type="text" value="" name="cost" style="display: none;">
</div>
<input type="radio" name="WE_WANT_s_name_HERE" id="{{:Id}}" value="{{:Name}}">
</div>
</div>
</div>
</div>
{{/for}}
{{/for}}
{{/for}} //products
感謝它爲我工作。 –