Cross-browser placehold and cross-browser placehold

Source: Internet
Author: User

Cross-browser placehold and cross-browser placehold

How to Implement the placeholder effect across browsers?
First look at the effect

The js Code is as follows:

$ ('# Username '). placeholder ({word: 'username', color: '# ddd', normalFontColor: '# f00', maxLen: 4, minLen: 2, errorBorderClass: 'errorborder', keyup_callback: function () {console. log ('keyup _ callback') ;}}); $ ('# password '). placeholder ({word: 'Enter the password', normalFontColor: '# f00', color:' # ddd '}, function () {console. log ('callback ');});

Parameter description:

Parameter Name Description Example
Word Text Box displays text by default Enter Password
Color Color of text displayed by default '# Ddd'
EvtType Event type, that is, what event triggers the default text to disappear The default value is 'focal'
MaxLen The maximum number of characters that can be entered in the text box. 0 indicates no limit.
MinLen The minimum number of characters entered in the text box. 0 indicates no limit.
NormalFontColor Font color for normal text input '# F00'
ErrorBorderClass Class that takes effect when an error occurs For example, if the number of characters in the input box is smaller than minLen, the class will be applied.
Keyup_callback Keyup callback function
Blur_callback Callback Function with invalid focus
Focus_callback Callback Function for getting focus
Click_callback Click the callback function of the event.
Keydown_callback The callback function of the keydown event.

Html instance

<! DOCTYPE html> 

Code:

[Write link content here] (http://pan.baidu.com/s/1kTzkfeJ
Write link content here

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.