1. jQuery

    Article: AN0002383Updated: 13.12.2018

    jQuery is a javascript library with a wide support by browsers that focuses on JavaScript and HTML interaction. Similarly like CSS separating form and content, which is HTML, jQuery separates behaviour from HTML structure. jQuery contains a wide range of functions for navigation through and change of DOM (Document Object Model), events, work with CSS, various effects and animations, AJAX and various utilities and plugins. You can manage much more with much less effort when using jQuery instead of trying to develop everything from scratch just by using pure JavaScript.

    Example

    $(document).ready(function() {
     // Background colour for odd, resp. even rows in tables by means of CSS classes oddRow, resp. evenRow.
     $('tr:odd').addClass("oddRow");
     $('tr:even').addClass("evenRow");
    });

    This example sets different background colours for odd and even rows in a table in a HTML page.

    You can use jQuery e.g. in ObjectGears webpart Script.

    Example of use from model Version Controlled Documentation.

    The first part of the script responds to a change in the combobox by navigating to a new page. The second part of the script sets for the textbox searchtb detection of user pressing a key. If the user presses Enter, then a page with search results is desplayed.

    $(document).ready(function ()
    {
      //response to a change of the selected version
      $("select#Version").change(function () {
         var url = $(this).attr('url') ;

        $("select#Version option:selected").each(function() {
            window.location = url + $(this).attr('value');
         });
       });

      //handle pressing enter at search
      $('.searchtb').keydown(function (event)
      {
        if (event.which == 13)
        {
          if (event.preventDefault) {event.preventDefault();} else {event.returnValue = false;}
          window.location = window.location.protocol + '//' + window.location.host + '/vcd/' +              OGC.ActualLocalize + '/search/' + $('.searchtb').val();
        }
      });
    });

     

    For more information we recommend w3schools, jquery.com and jqueryui.com.

×