Greg Hinch![]()
Often it is useful to show "placeholder" or "example" text in form inputs/textareas. Newer browsers support the "placeholder" attribute, but this does not work across older versions. This plugin adds the functionality via script, which can be changed on the fly. Additionally, unlike the browser native version, the text can be configured to hide on "focus" or on the first character entered into the field.
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2012.06.20-20-07'
}).use('gallery-placeholder', function(Y) {
var ipt = Y.one('#my-input');
ipt.plug(Y.Plugin.Placeholder, {
text : 'First Name',
hideOnFocus : false
});
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info