Copied to clipboard

Flag this post as spam?

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


  • Kevon K. Hayes 255 posts 281 karma points
    Dec 27, 2011 @ 14:39
    Kevon K. Hayes
    0

    Adding logic to the editContent.aspx

    UMB 4.7.1
    .NET 4.0
    WIN SVR 2008 R2 ENT

    Umbraco Devs,

    Are there best practices one should follow when adding custom Javascript to the editContent.aspx page?  It seems as if my simple javascript is not functioning. 

    $("#myButton").click(function(){
    alert("Yes");
    });

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Dec 27, 2011 @ 14:56
    Jeroen Breuer
    0

    Why would you want to add javascript to that page? It's part of the Umbraco source and shouldn't be changed. Have you tried adding javascript with a custom datatype?

    Jeroen

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 27, 2011 @ 15:08
    Kevon K. Hayes
    0

    Yes, so to clarify, I am using a custom datatype and my script is not firing. Adding the script to my editContent.aspx would be my next attempt.  This was the actual script that didn't fire:

    function togIt()
    {
        $(document).ready(function () {
            $("#btnSubmit").click(function () {
                $("#registrationWrapper").toggle();
                });
        });  
    }

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 27, 2011 @ 15:19
    Dirk De Grave
    1

    Kevon,

    you should add your js script in your custom datatype code

     

    Cheers,

    /Dirk

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 27, 2011 @ 15:21
    Kevon K. Hayes
    0

    OK Gentlemen,

    It's apparent that I missed something I'll go back and review my code and see where I'm going wrong.  I usually am... 

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Dec 28, 2011 @ 00:07
    Lee Kelleher
    1

    Hi Kevon,

    We use custom JavaScript for most of the data-types in uComponents - take a look at the source-code if you need any pointers ... or ask mroe questions, happy to help answer them!

    My guess if that your JavaScript is trying to access the jQuery object at the wrong stage ... but would need to see more of your code to figure out what the problem is.

    Cheers, Lee.

  • Kevon K. Hayes 255 posts 281 karma points
    Jan 02, 2012 @ 16:09
    Kevon K. Hayes
    0

    Everything's working now js path was incorrect.

Please Sign in or register to post replies

Write your reply to:

Draft