To set the width of each div on click to 30px plus a color change. : DIV « jQuery « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Dojo toolkit
7. Event
8. Event onMethod
9. Ext JS
10. Form Control
11. GUI Components
12. HTML
13. Javascript Collections
14. Javascript Objects
15. Javascript Properties
16. jQuery
17. Language Basics
18. Mochkit
19. Mootools
20. Node Operation
21. Object Oriented
22. Page Components
23. Rico
24. Scriptaculous
25. Security
26. SmartClient
27. Style Layout
28. Table
29. Utilities
30. Window Browser
31. YUI Library
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript DHTML » jQuery » DIV 
To set the width of each div on click to 30px plus a color change.
  

<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).width(30)
                             .css({cursor:"auto""background-color":"blue"});
                  });

               


        });
    </script>
<style>

  div width:50px; height:70px; float:left; margin:5px;
        background:rgb(255,140,0); cursor:pointer; }
  
</style>
  </head>
  <body>
    <body>
          <div></div>
          <div></div>
                 
    </body>
</html>

   
    
  
Related examples in the same category
1. Append to DIV
2. Change DIV background
3. Click to add border
4. Click to change DIV tag color
5. Set DIV color
6. Get text from paragraph and set to DIV
7. Fade div to a random opacity on each click, completing the animation within 200 milliseconds.
8. Animates all divs to slide down and show themselves over 600 milliseconds.
9. Animates divs between dividers with a toggle that makes some appear and some disappear.
10. Sets id for divs based on the position in the page.
11. Bind a single click that adds the div id to its text.
12. Add html to div then do further manipulations to the inserted html.
13. Turn the div with index 2 blue by adding an appropriate class.
14. Change the color of all divs then put a border around only some of them.
15. Change the color of all divs then put a border two specific ones.
16. Adds a border to divs that are not green
17. Finds all divs adds all paragraphs
18. Find all children of each div.
19. Locate all the divs after the first and give them a class.
20. Tie a one-time click to each div.
21. Hides the divs when clicked over 2 seconds, then removes the div element when its hidden.
22. To set the height of each div on click to 30px plus a color change.
23. Wrap a jQuery object div around all of the paragraphs
24. Animates all hidden divs to show fastly in order
25. Hides the divs when clicked, then removes the div element when its hidden.
26. Creates a div element (and all of its contents) dynamically, and appends it to the body element.
27. Bind mouse over and out event to div tag
28. Switch class when clicking the div tag
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.