[英]How to call checkbox change event before checked/unchecked in AngularJS?
[英]multiselect checkbox dropdown call an Event when checked and Unchecked
这是我选中多个下拉复选框时的 html 内容,我想调用一个 java 脚本函数,但它不起作用。 我正在使用多选 jquery 多选 jquery
<select name="langOpt2[]" multiple id="langOpt2">
<?php foreach($property_type as $row) { ?>
<option value="<?php echo $row['type']; ?>" onchange="selectsearch(this.checked,'property_type',this.value);"><?php echo $row['type']; ?> </label>
</option>
<?php } ?>
</select>
我的 javascript 代码是 -
<script language="javascript">
function selectsearch(val2,val1,state_id)
{
var title=state_id;
alert('action');
$.ajax({
url: '<?php echo base_url(); ?>index.php/property/propertysearch',
data: {'title':title,'name':val1,'status':val2 }, // change this to send js object
type: "post",
success: function(data){
//document.write(data); just do not use document.write
console.log(data);
document.getElementById('search').innerHTML = data;
document.getElementById('search').style.display = 'block';
document.getElementById("search1").style.display = 'none';
},
error: function()
{
alert("Fail")
}
});
}
</script>
<select name="langOpt2[]" multiple id="langOpt2" >
<option value=""></option>
<option value="type1" onclick="selectsearch(this.selected, 'property_type', this.value)">Type 1</option>
<option value="type2" onclick="selectsearch(this.selected, 'property_type', this.value)">Type 2</option>
</select>
将this.checked
更改为this.selected
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.