Run jQuery function onclick

前端 未结 4 532
梦如初夏
梦如初夏 2021-02-08 02:28

so i implemented a bit of jQuery that basically toggles content via a slider that was activated by an tag. now thinking about it id rather have the DIV th

4条回答
  •  盖世英雄少女心
    2021-02-08 02:32

    Why do you need to attach it to the HTML? Just bind the function with hover

    $("div.system_box").hover(function(){ mousin }, 
                              function() { mouseout });
    

    If you do insist to have JS references inside the html, which is usualy a bad idea you can use:

    onmouseover="yourJavaScriptCode()"
    

    after topic edit:

    ...

    $("div.system_box").click(function(){ slideonlyone($(this).attr("data-target")); });
    

提交回复
热议问题