Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Dante
  • #182902
    triinum
    Member
    Post count: 45

    I have a quite basic js code, which only works in footer.php with Jquery source. I’m still having issues with getting it working when placed in custom js, it just doesn’t work. There must be something wrong with the custom js box…

    <script>
    $(‘.showbirthdaychild’).hide();
    $(‘#arve_number_field’).hide();
    $(‘.arve-checkbox input[type=”checkbox”]’).on(‘click’, function () {
    $(‘.arve-text’).slideToggle();
    });

    $(‘.addchild’).on(‘click’, function(){
    $(‘.showbirthdaychild’).slideToggle();
    $(‘.addchild’).hide();
    });
    </script>

    #182914
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    Don’t include the script tags, and you should place that js inside the Document ready in my opinion.

    
    jQuery( document ).ready(function() {
         //Place the code here
    });

    Also replace the $ by jQuery

    Hope it helps.

    -Rui

    #182989
    triinum
    Member
    Post count: 45

    By not including the tags it just appears on the bottom of the page, remember you suggested the tags? Anyway, see the footer yourself and try the custom js box – it just doesn’t work… the same code worked fine in footer.php, but then other jquery elements wouldn’t work.

    #183063
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please use this code

    <script>
    jQuery( document ).ready(function($) {
    $('.showbirthdaychild').hide();
    $('#arve_number_field').hide();
    $('.arve-checkbox input[type="checkbox"]').on('click', function () {
    $('.arve-text').slideToggle();
    });
    
    $('.addchild').on('click', function(){
    $('.showbirthdaychild').slideToggle();
    $('.addchild').hide();
    });
    });
    </script>

    Thanks
    Mohammad

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register