Skip to content Skip to sidebar Skip to footer

Show Button When User Focus Into Textarea Using Jquery

I want textbox to be visible when user take cursur into textbox. HTML: ).show(); }); $("#text").on("blur", function( e ) { $('#b1').hide(); }); });

Be sure that you've added JQuery in HEAD.

Solution 2:

You're using the keypress event, so it won't be shown until the user actually types a key. You want the focus event:

$(document).ready( function() {
    $("#text").bind("focus", function( e ) {
        document.getElementById("b1").style.display = "block";
    });
});

Solution 3:

$(function() { // document ready
    $('input#text').on('keyup.showButton', function() { // creating keyup event with namespace
        $('button#b1').filter(':hidden').fadeIn(); // if button is hidden - show it
    });
});

Solution 4:

have you included the jQuery library.?? I haven't seen in jsFiddle just check so that can cause a problem with selectors..

Just include library your code is perfect. I have tested it..

Post a Comment for "Show Button When User Focus Into Textarea Using Jquery"