JQuery

How to create a help icon using fadeToggle in jQuery?

How to create a help icon using fadeToggle in jQuery?, someone asked me to explain?

In this article we will discuss how to create a help icon using fadeToggle in jQuery. We will set <span> help text to display none. When the user click on the help icon we will implement fadeToggle() propery to make showing or hiding by setting <span>helptext display property to block or none .

Example:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>color animationeffect on search button click</title>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" />
    <style type="text/css">
        form {
            width: 280px;
            margin: 100px auto;
            position: relative;
        }
        input {
           width: 200px;
            height: 40px;
            border: 1px solid #B6BBBF;
            font-size: 19px;
        }
        #help {
            display: block;
            width: 16px;
            height: 16px;
            margin-top: 3px;
            float: right;
            cursor: pointer;
            background: url(http://www.infinetsoft.com/Uploads/20160524063905025.png) no-repeat;
        }
        #helpText {
            display: none;
            border: 1px solid #DED8D8;
            width: 100px;
            height: 75px;
            padding-top: 5px;
            position: absolute;
            left: 115px;
            top: -90px;
            font: normal 12px "NimbusSans L", "Helvetica Neue", "Franklin Gothic Medium", Sans-serif;
            background: url(http://www.infinetsoft.com/Uploads/20160524063921026.png) no-repeat;
            padding-left: 35px;
        }
    </style>
    <script type="text/javascript">
      $(document).ready(function () {
            $("#help").click(function () {
                $("#helpText").fadeToggle();
            });
        });
    </script>
</head>
<body style="border: 1px solid #DED8D8; width: 500px; height: 270px; font-family: Arial;">
    <h1 style="color: #841198">color animation effect on search button click  </h1>
    <form>
        <label for="name">
           Enter your name:
            <input id="name" name="name" type="text">
            <span id="help"></span>
            <span id="helpText">Your name. You know, the thingthat people
call you by</span>
        </label>
    </form>
</body>
</html>

Output:

create a help icon using fadeToggle

Post your comments / questions