Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil Hodges 338 posts 987 karma points
    Jan 04, 2013 @ 13:16
    Neil Hodges
    0

    Simple jQuery in MainMasterpage?

    Hi

    Im fairly new to using Umbraco and Tea Commerce so forgive my ignorance but i seem unable to figure out why in my main master page i cannot use a simple script tag to use jQuery.

    The code id like to use is

    <script type="text/javascript">
            $(document).ready(function() {
                $('.ContactForm').hide();
                $('#SeeContactForm').click(function() {
                    $('.ContactForm').slideToggle('slow', function() {
                       
                    });
                });
            });
        </script>

    i get no error in firbug error console, it just seems not to be hitting the juery. I can see the relavent links to the core Jquery .js file, so its referenced correctly as other functionality on the site works fine.

    Ive tried putting this jueary code within one of the other .js files i.e. teacommerce_siple.js but again it doesnt seem to hit the jQuery.

    Should i be doing something different to make jquery work?

    Any help would be greatly appreciated, it must me be a simple fix?

    Kind Regards

    Neil.

  • Rune Grønkjær 1372 posts 3103 karma points
    Jan 04, 2013 @ 14:09
    Rune Grønkjær
    100

    Hi Neil,

    Have you checked your page source code, to see if your code is there at all :)

    Also try opening your script and setting a breakpoint in firebug, or whatever browser you are using.

    You could also try removing your code and inserting a simple alert('BANG') to see if that's run.

    If none of that works I might need a link to be able to debug it myself.

    /Rune

     

  • Neil Hodges 338 posts 987 karma points
    Jan 04, 2013 @ 14:42
    Neil Hodges
    0

    Hi

    Thanks for the reply, ive had a play around and its working fine now.

    No idea why it woudlnt work i literally refreshed the page a few times and it started working, maybe a cache issue?

    Sods law as soon as i posted this question it started working, thanks for your help though :)

     

    Neil.

Please Sign in or register to post replies

Write your reply to:

Draft