<div class="bit-4 pad-small">
<label>Cheque No</label>
<?php echo $this->Form->input('cheque_no',array('label'=>false,'class'=>'custom-select','options' =>'' ,'empty' => '','required')); ?>
<span>required</span>
</div>
<div class="bit-4 pad-small">
<label>DD No</label>
<?php echo $this->Form->input('dd_no',array('label'=>false,'class'=>'custom-select','options' =>'' ,'empty' => '','required')); ?>
<span>required</span>
</div>
<div class="bit-4 pad-small" style="float:none;">
<br>
<br>
<?php echo $this->Form->input('approve', array(
'type'=>'checkbox',
'style' => 'float:left;',
'label'=>'Approval of order',
'format' => array('before', 'input', 'between', 'label', 'after', 'error' )
) ); ?>
<span>required</span>
</div>
<div class="bit-12" >
<input type="submit" value="Submit" class="form-submit button" />
</div>
</div>
当我点击提交时,如果我点击批准,则必须显示绿色勾号,否则必须显示红色勾号。我该怎么做?
答案 0 :(得分:1)
将“批准按钮”的onChangeApprove
功能 onchange 事件置于其中。
function onChangeApprove(thisObj) {
if ($(thisObj).is(":checked")) {
//change btn color to Green
$("#imgControl").attr("src","/../img/green.png")
} else {
//change btn color to Red
$("#imgControl").attr("src","/../img/red.png")
}
}