Click to add border : DIV « jQuery « JavaScript Tutorial






<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
           $("div").one('click', function () {
              $(this).css({"border-style": "inset", cursor:"default"});
              
           });
        });
    </script>

  </head>
  <body>
    <body>
      Press each to see the text.
      <div>asdf</div>
      <div>sdf</div>
      <div>df</div>
      <div>sdf</div>
      <div>asdf</div>
      <div>asdf</div>
      <p></p>
  </body>
</html>








30.135.DIV
30.135.1.Append to DIV
30.135.2.Change DIV background
30.135.3.Click to add border
30.135.4.Click to change DIV tag color
30.135.5.Set DIV color
30.135.6.Get text from paragraph and set to DIV
30.135.7.Fade div to a random opacity on each click, completing the animation within 200 milliseconds.
30.135.8.Animates all divs to slide down and show themselves over 600 milliseconds.
30.135.9.Animates divs between dividers with a toggle that makes some appear and some disappear.
30.135.10.Sets id for divs based on the position in the page.
30.135.11.Bind a single click that adds the div id to its text.
30.135.12.Add html to div then do further manipulations to the inserted html.
30.135.13.Turn the div with index 2 blue by adding an appropriate class.
30.135.14.Change the color of all divs then put a border around only some of them.
30.135.15.Change the color of all divs then put a border two specific ones.
30.135.16.Adds a border to divs that are not green
30.135.17.Finds all divs adds all paragraphs
30.135.18.Find all children of each div.
30.135.19.Locate all the divs after the first and give them a class.
30.135.20.Tie a one-time click to each div.
30.135.21.Hides the divs when clicked over 2 seconds, then removes the div element when its hidden.
30.135.22.To set the width of each div on click to 30px plus a color change.
30.135.23.To set the height of each div on click to 30px plus a color change.
30.135.24.Wrap a jQuery object div around all of the paragraphs
30.135.25.Animates all hidden divs to show fastly in order
30.135.26.Hides the divs when clicked, then removes the div element when its hidden.
30.135.27.Creates a div element (and all of its contents) dynamically, and appends it to the body element.