JCallout easily implements the bubble prompt Function

Source: Internet
Author: User

Https://github.com/anupamsmaurya/jCallout of jCallout

Need to add this reference

The html code for a user name line is:

Copy codeThe Code is as follows:
<Tr>
<Td class = "columnName"> User name: </td>
<Td> <input id = "hTbxUserName" class = "needCheck" type = "text"/> <span class = "necessary"> * </span> </td>
</Tr>

Then add the following code in js:

Copy codeThe Code is as follows:
$ ('# Htbxusername'). jCallout (
'Initwithoutshow ',{
Message: "required! ",
Position: "right ",
BackgroundColor: "# f00 ",
TextColor: "# fff ",
ShowEffect: "fade ",
Showspeed: 300,
HideEffect: "fade ",
Hidespeed: 300,
$ CloseElement: $ ('')
});

Note that jCallout has two initialization Methods: init and initWithoutShow. After the former is initialized, the bubble is immediately displayed, and the latter is not immediately displayed. You need to add the code display when necessary:

Copy codeThe Code is as follows:
Var $ userNameInput = $ ("# hTbxUserName ");
$ UserNameInput. blur (function (){
If ($ userNameInput. val (). length = 0 ){
$ UserNameInput. jCallout ('show ');
}
});

The parameter $ closeElement is the close button for setting bubbles. You can see the plug-in source code.

Copy codeThe Code is as follows:
$ CloseElement: $ ('<span style = "float: right; cursor: pointer"> (X) </span> '),

If you do not set $ closeElement: $ (''), the following information is displayed. Click (x) to close the bubble:

In addition, the bubble can also display the image and write the html code of the image to the message Parameter:

Copy codeThe Code is as follows:
Message: " required! "

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.