您好,当我呈现choicesType元素时,我使用了Materialize css和symfony
<div class="row" id="indirizzo_row">
<div class="input-field col s12">
{{ form_widget(form.idIndirizzo) }}
<label for="textarea" class="">Indirizzo</label>
</div>
html的结果是:
<div class="row" id="indirizzo_row">
<div class="input-field col s12">
<div class="select-wrapper initialized"><span class="caret">▼</span>
<input type="text" class="select-dropdown" readonly="true" data activates="select-options-404a0618-34d9-457a-953e-d80885817d6c" value="Value1">
<ul id="select-options-404a0618-34d9-457a-953e-d80885817d6c" class="dropdown-content select-dropdown ">
<li class=""><span>Value1</span></li>
</ul>
<select id="appbundle_select_id" name="appbundle[idIndirizzo]" class="initialized">
<option value="1221">Value,1</option></select>
</div>
<label for="textarea" class="">Indirizzo</label>
</div>
</div>并且select显示为:none
我的目标是在jquery重载字段中添加或删除一个选项选择值
我试试这个:
$("#indirizzo_row").load(location.href+" #indirizzo_row>*","");
(this add a option in select but not in ul li list
$("#indirizzo_row").material_select();但它不起作用
发布于 2017-08-27 14:51:10
$("#indirizzo_row select").material_select(); 或
$("#appbundle_select_id").material_select();尝试测试。您需要使用Select元素。
发布于 2017-08-28 15:43:23
我明白我错了
$("#select_id").material_select(); 在此之前工作
$("#select_id").load(location.href+" #select_id>*",""); finish.所以我决定用
$("#select_id").load(location.href+" #select_id>*",function(){
$('select').material_select();
});https://stackoverflow.com/questions/45858914
复制相似问题