Creating a reusable jQuery function

前端 未结 2 374
广开言路
广开言路 2021-01-24 14:56

Instead of re-writing a massive block of code each time, I\'m trying to incorporate functions into my work but I\'m having trouble making it work.

Basically, I\'ve got a

2条回答
  •  清歌不尽
    2021-01-24 15:01

    Why not just update the src tag of the iframe ...

    $('#cTheme1').click(function () { 
        $('input:radio[name=mgChooseTheme]:nth(1)').attr('checked',true); 
                $('#liveDemoFrame').attr('src', );
    });
    

    Then your iframe would already need to be part of the page :

    
    

    i notice your using a CLASS attribute on your iFrame and accessing it using that - you really need to think about using the ID attribute if you are just wanting to refer to a single object. (as in my example above)

提交回复
热议问题