简体   繁体   中英

bulma input field with right icon : how to bind jquery event

Having an input type=password field made with bulma with an additional icon on the right, i want to bind an onclick event with jquery to this icon, to toggle the visibility of the password. it does not react this way.. every hint is welcome, thanks

    <div class="field">
        <p class="control has-icons-left has-icons-right">
            <input id="form_password" class="input" type="password" placeholder="Password">
            <span class="icon is-small is-left">
                <i class="fa fa-lock"></i>
            </span>
            <span id="btn_toggle" class="icon is-small is-right">
                <i class="fa fa-eye"></i>
            </span>
        </p>
    </div>

<script>

    $('#btn_toggle').bind("click", function() {
        alert('btn clicked');
    });
</script>

Ok, i found the answer by myself. It's the icon class in bulma.

<span id="btn_toggle" class="icon is-small is-right" style="pointer-events: all; cursor: pointer">
    <i class="fa fa-eye"></i>
</span>

now it works..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM