0
我需要修改使用CakePHP和JQuery在輸入表單中創建的標籤。將標籤修改爲輸入
$info = "test";
echo $this->Form->input('tipo_de_venta', array('type' => 'select', 'label' => 'Tipo de venta'.$info, 'div' => 'required', 'options' => $opciones_tipo_venta));
我在做什麼是設置一個變量$info
用默認值,並更改每次選擇更改值的選項。根據選擇
$('#tipo_de_venta').on('change', function() {
console.log(this);
if(this.value == 1){
}
if(this.value == 0){
}
if(this.value == 2){
}
});
嘗試$(this).text("Change");
但它不適用於我。
HTML:
<div class="required">
<label for="EventoTipoDeVenta">Tipo de venta</label>
<select name="data[Evento][tipo_de_venta]" id="EventoTipoDeVenta">
<option value="0">Compra simple</option>
<option value="1">Change</option>
<option value="2" selected="selected">Compra multiple simplificada</option>
</select>
</div>
您可以添加最初呈現的HTML? – RRK
最初的HTML?你什麼意思? – hateful
從頁面源加載頁面時的輸入和其他元素的html。 – RRK