htmlとcssとjqueryとunderscoreで一つのhtmlファイルにコードを書いています。
<td>タグ内にサーバからオブジェクト化したjsonデータを持ってきて、プルダウンに表示させたいです。 (例えば、出席簿テーブルから名前のデータをプルダウン表示させるなど) また、それをunderscoreのtemplate内に書きたいです。どうすればよいでしょうか。今のところ、出るエラーは~is not definedやrange error invalid string length等です。
ちなみに、コードはこのような形です。
<script type="text/template" id="um"> <tbody id="tb"> <% for(var i=0; i < 3; i++){ %> <tr class="cs-list0 cs-pointer"> <td class="list0-col1"><select class="form-control input-sm" id="mame" name="name"> <option value=""></option> <% for(var i=0; i < 入れたいデータ.length; i++){ %> <option value="<%- 入れたいデータ[i] %>"><%- 入れたいデータ[i] %></option> <% } %></select> </td> <td class="list0-col2"><input type="checkbox" name="sup"></td> <td class="list0-col3" data-td=""><input type="text" size="40" class="note"></td> </tr> <% } %> </tbody> </script>回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/05/24 04:59