Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Carregar automaticamente jquery_Jquery_Checkbox_Fadein_Show Hide_Fadeout - Fatal编程技术网

Carregar automaticamente jquery

Carregar automaticamente jquery,jquery,checkbox,fadein,show-hide,fadeout,Jquery,Checkbox,Fadein,Show Hide,Fadeout,我在这个脚本中遇到了一个问题,它只在我单击复选框时运行,但是如果我让复选框由html自动选中,则不会发生任何事情 有人在这件事上帮我吗在DOM就绪时执行处理程序 <script type='text/javascript'>//<![CDATA[ $(function (){ $('.check1').change(function () {//clicou em check1 if ($(this).attr("checked")) { $

我在这个脚本中遇到了一个问题,它只在我单击复选框时运行,但是如果我让复选框由html自动选中,则不会发生任何事情


有人在这件事上帮我吗

在DOM就绪时执行处理程序

<script type='text/javascript'>//<![CDATA[ 
$(function (){
$('.check1').change(function () {//clicou em check1
    if ($(this).attr("checked")) 
    {
        $('.check3').fadeOut();//some check3
        $('.resultado1').fadeIn();
        return;
    }
   $('.resultado1').fadeOut();
   $('.check3').fadeIn();//desmarcou check1, check3 volta
   $('.check3').attr("checked", false);//check3 volta falso

});


});//]]>  

</script>

<input type="checkbox" class="check1" checked >

<div class="resultado1">Hello World</div>

<input type="checkbox" class="check2">

<input type="checkbox" class="check3">
$('.check1').change(function () {//clicou em check1

    // implementation

}).change();