9 Replies Latest reply on Jun 28, 2017 8:58 AM by marcustephan

    Simple jquery

    marcustephan

      This code:

      <script>

      $( document ).ready(function() {

      console.log('TEST:', $('#j-placeMainNav') );

      })

      </script>

       

      TEST

       

      Is producing a $ is not defined

      If I use $j(...) the message is $j is not defined

       

      This code:

      if I do this:

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

      <script>

      $( document ).ready(function() {

      console.log('TEST:', $('#j-placeMainNav') );

      })

      </script>

       

      TEST

       

      then I get a:

      Any advice so far?

       

      I just wanna get the j-placeMainNav and wanna append a new LI dynamically on a specific page

       

      (and yes I insert the HTML tile, javascript is in general executed)

        • Re: Simple jquery

          Hi Marcustephan,

           

          Seems like jQuery hasn't actually loaded when you're calling it with the $document.ready method. You can try adding the script after the body tags and see if that does the trick (still loading the library in the head). If that doesn't work still, try setTimeout and see if adding a delay before runnign the script makes a difference. If not, we can see if there's some bug going on.

          • Re: Simple jquery
            marcustephan

            OK

             

             

             

            I have figured it out what it is !

             

            Thanks

              • Re: Simple jquery

                If it's something valuable to save other's time, please feel free to share your solution with us!

                  • Re: Simple jquery
                    marcustephan

                    the key is an html widget is inside an iframe .... honestly I expected the answer from you (as product specialist?)

                      • Re: Simple jquery

                        Marcus, WRT to Rashed asking you to share your solution, it was to potentially benefit others who might share a similar permutation of circumstances. I myself have never had an issue loading jQuery in a Widget or Tile in my 10 years of doing Jive development ... so even to me, something was off in the scenario.

                         

                        To be clear for others who read this thread in the future, since Widgets and Tiles are loaded via iFrames (Widgets on-domain, Tiles off-domain), the main Jive UI is not part of the Widget/Tile DOM, which can complicate although (depending on your setup) not completely eliminate your ability to read/impact the Jive UI DOM.

                         

                        Going a bit deeper into your question, you said you are trying to add a new navigation item to a given place's navbar.  I would strongly recommend you check out:

                        App Action Contribution Reference > Place Tab View + Conditional Display of App Actions

                        or creating a Tile Page for the place and dropping a Full Widget Custom View Tile experience (whichever you are more comfortable with).

                         

                        Both solutions would render you a custom navbar experience (with bookmarkable URL) on a per-container basis (not global).

                         

                        That being said, to answer your follow-up, you can test this out on the Jive Sandbox (see: How to Access the Official Jive Developer Sandbox)

                         

                        Hope that helps.

                          • Re: Simple jquery
                            marcustephan

                            Hello Ryan,

                            thank you for your last recent message to me. Its very helpful.

                            I am totally new to jive, working at a client and create a new set of pages for them in jive (so that they can build a landing page kind of automatically from different sub pages)

                            I did already development for confluence, joomla, wordpress, teamsite, etc. but have to say I love jive more than all the other systems, for some reason it seems for me to be the right system for me.

                            I plan to become an jive expert/developer (plugins etc.) and need some informations to make sure I am on the right track.

                            Lets say I plan a business web app or a new social media platform or just a mobile app. Do you think I can use jive in all three cases?

                            What about  this:

                            a) is developing on the platform free for me as developer?

                            b) Who can host my final product (jive based/integrated)?

                            c) What are the costs if my product is running jive based on your systems?

                            (is this possible?)

                            d) Is there any program for developers where I can say for example on my resume "I am a jive developer' or any other stuff like this?

                            I develop a lot of side projects and still need the right platform with a rich feature set ....

                            Thank you

                            Marcus

                        • Re: Simple jquery
                          marcustephan

                          Hi Rashed,

                           

                           

                           

                          another question.

                           

                           

                           

                          How can I today test and try the forms app on my 30 day trial instance. This would be very important for us to convience our lcient to stay with jive in the current project ...

                           

                           

                           

                          Please advice