0

ここに jsfiddle があります: http://jsfiddle.net/nGpmP/

When you click on that input, the button on the right appears. This button has onclick(); event. The problem is, that this event is not firing up, since, when you click on a button, it disappears (and input is loosing focus), and javascript is not being fired up. How can I do it, so that this javascript will be executed?

4

4 に答える 4

2
.buttonInput input:not(:focus) ~ .buttonIcon {
    display: none;
}

になる

.buttonInput .buttonIcon {
    display: none;
}

.buttonInput input:active ~ .buttonIcon {
    display: inline-block;
}

になる

.buttonInput .buttonIcon:active {
    display: inline-block;
}

このようにして、ボタンはクリックするまで消えません。

http://jsfiddle.net/7uFVS/1/

于 2013-05-29T15:35:50.127 に答える
0

jsfeedle にいくつかの変更を加えました。いくつかの ID と 2 つの jquery 関数を追加

<div class="buttonInput">
    <input id="inputbox" type="text" placeholder="Status..."/> 
    <div id="clearBtn" class="buttonIcon" onclick="ClearInput(this);">BTN</div> 
</div>
<script>
    $('#inputbox').click(function(){
        $('.buttonIcon').css('display','block');
    });

    $('#clearBtn').click(function(){
        $('#inputbox').val(' ');
    });
</script>

http://jsfiddle.net/Qpd6V/

于 2013-05-29T15:40:33.417 に答える