Changeset 4183
- Timestamp:
- 12/16/07 16:40:56 (1 year ago)
- Files:
-
- 1 modified
-
trunk/plugins/validate/test/events.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/validate/test/events.html
r4090 r4183 10 10 11 11 <script type="text/javascript"> 12 $().ready(function() { 13 var current; 14 function focus(event) { 15 if (current != null) 16 return; 17 var form = $(this); 18 var target = $(event.target); 19 if (target.is("label") && event.type != "mousedown") { 20 target = $("#" + target.attr("for")); 21 } 22 if (target.is(":text, textarea")) { 23 current = target; 24 target.addClass("focus").one("blur", function() { 25 $(this).removeClass("focus"); 26 current = null; 27 }); 28 } 29 } 30 $("#commentForm").keyup(focus).mousedown(focus).click(focus).submit(function() { 31 return false; 32 }); 12 33 13 $().ready(function() {14 function handle(event) {15 console.log("this", this, "type", event.type, "target", event.target);16 }17 $("#commentForm").keyup(handle).blur(handle).change(handle).focus(handle).mouseup(handle);18 //$(":input").change(handle).blur(handle).keyup(handle).focus(handle).bind("input", handle);19 34 }); 20 35 </script> … … 22 37 <style type="text/css"> 23 38 #commentForm { width: 500px; } 24 #commentForm label { width: 250px; }39 #commentForm label { width: 250px; display: block; float: left; } 25 40 #commentForm label.error, #commentForm input.submit { margin-left: 253px; } 26 27 #signupForm { width: 670px; } 28 #signupForm label.error { 29 margin-left: 10px; 30 width: auto; 31 display: inline; 32 } 33 #newsletter_topics label.error { 34 display: none; 35 margin-left: 103px; 36 } 41 .focus { background-color: red; } 37 42 </style> 38 43 39 44 </head> 40 45 <body> 41 42 46 <form class="cmxform" id="commentForm" method="get" action=""> 43 47 <fieldset>
