Jquery Event in JS

This question already has an answer here:

  • $(document).ready equivalent without jQuery 31 answers

  • Use DOMContentLoaded. Here is the full example.

    document.addEventListener("DOMContentLoaded", function(event) {
        function FormFill() {
                if {
                    var el1 = document.getElementsByName("FormOption1")[0];
                if(typeof el1 !== 'undefined') {el1 = 1;}         
                    var el2 = document.getElementsByName("FormOption2")[0];
                if(typeof el2 !== 'undefined') {el2 = 2;}  
                }, 100);
            }
        }
        setTimeout(FormFill,5000);
    });
    
    链接地址: http://www.djcxy.com/p/71252.html

    上一篇: 内容加载后如何运行jquery代码?

    下一篇: JS中的jquery事件