Every repository with this icon (
Every repository with this icon (
tree 4e2ac380c59cc7c7f9754fcef21d5c64191733f5
parent 722a54c39bc665dce8e43bbd89f719a0ebea5c05
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README.markdown | ||
| |
lib/ | ||
| |
spec/ |
jQuery Plugins
This is a collection of useful jQuery plugins
Placeholder
Mimics Safari's placeholder attribute on other browsers.
Usage
On Javascript:
$("input#name").placeholder("Type your name");
On CSS, you can style the field using the .placeholder class:
.placeholder {
color: #aaa;
}
Disable multiple submit
Prevents form from being submitted twice.
Usage
$(":submit").disableMultipleSubmit()
$(":submit").disableMultipleSubmit("Still processing your request")
Render
A simple rendering plugin that replaces the object attributes/elements automatically.
Usage
Create views that the plugin can use:
$.render.views["user"] = "<div class='user' id='user-@id'>
<h1 class='name'></h1>\
<img alt="@name" class="avatar_url" />
</div>";
Then you can render this view using the $.render() function.
$.render("user", {name: "John Doe", id: 1, avatar_url: "john.png"});
The snippet above will replace all @attr placeholders. When a given tag is an image,
then the replaced value will be a src attribute.
You can use inline views. Just specify the template and let the render plugin do the rest.
$("div.user:first").render(records);
There are two callbacks; one for formatting values and other that will be dispatched when the rendering is completed. The example above will uppercase all attribute values and display an alert when rendering is done.
var user = {name: "John Doe", id: 1, avatar_url: "john.png"};
$.render("user", user, {
formatter: function(attr, value) { return value.toString().toUpperCase(); },
ready: function(renderedView) { alert("Finished rendering!"); }
});
TODO
- Placeholder
- When input is a password field, switch type to text, so the text can be displayed - http://vivin.net/2009/05/26/jquery-tip-changing-the-type-attribute-of-an-input-element/
License
(The MIT License)
Copyright (c) 2009 Nando Vieira http://simplesideias.com.br
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.








