Class JQueryUtils


  • public class JQueryUtils
    extends Object
    Utility class for javascript / jQuery statements
    Author:
    Sebastien Briquet - sebfz1
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String detach​(String selector)
      Gets the statement that detaches the element matching the current selector from the DOM.
      The #detach method is the same as #remove, except that #detach keeps all jQuery data associated with the removed elements.
      This method is useful when removed elements are to be reinserted into the DOM at a later time.
      static String remove​(String selector)
      Gets the statement that removes the element matching the current selector from the DOM.
      Use #remove when you want to remove the element itself, as well as everything inside it.
      In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.
      To remove the elements without removing data and events, use #detach instead.
      static String trycatch​(String statement)
      Wraps a js statement into a try-catch block
      static String trycatch​(String statement, boolean warn)
      Wraps a js statement into a try-catch block
    • Method Detail

      • trycatch

        public static String trycatch​(String statement)
        Wraps a js statement into a try-catch block
        Parameters:
        statement - the js statement
        Returns:
        the wrapped statement
      • trycatch

        public static String trycatch​(String statement,
                                      boolean warn)
        Wraps a js statement into a try-catch block
        Parameters:
        statement - the js statement
        warn - whether a warn should be logged to the console
        Returns:
        the wrapped statement
      • detach

        public static String detach​(String selector)
        Gets the statement that detaches the element matching the current selector from the DOM.
        The #detach method is the same as #remove, except that #detach keeps all jQuery data associated with the removed elements.
        This method is useful when removed elements are to be reinserted into the DOM at a later time.
        Parameters:
        selector - the jQuery selector
        Returns:
        the statement
        See Also:
        remove(String)
      • remove

        public static String remove​(String selector)
        Gets the statement that removes the element matching the current selector from the DOM.
        Use #remove when you want to remove the element itself, as well as everything inside it.
        In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.
        To remove the elements without removing data and events, use #detach instead.
        Parameters:
        selector - the jQuery selector
        Returns:
        the statement
        See Also:
        detach(String)