コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
9810 ビュー

     Im trying to get array[0] as value for the 'attroption' and array[1] as value for 'attrweight' in the code below. How can I do this? Or is there any other way to set this value? 

<div style="visibility: hidden" t-esc="value_id.name" id="attributename"/>                                    
<div style="visibility: hidden" id="attributeextraweight"/>
<script type="text/javascript">
var input = $("attributename").text();
var array = input.split('+');
$("attributename").html(array[0]);
$("attributeextraweight").html(array[1]);
</script>
<t t-set="attroption" t-value=""/>
<t t-set="extraweight" t-value="attrweight"/>
アバター
破棄
最善の回答

HI,

You can set like this

<t t-set="attroption" t-value="value_id.name.split('+')[0]"/>

<t t-set="extraweight" t-value="value_id.name.split('+')[1]"/>

アバター
破棄
関連投稿 返信 ビュー 活動
3
8月 17
8975
0
1月 25
937
0
2月 24
1196
0
8月 23
2313
1
2月 23
2662