当我点击另一个时,如何在JavaScript中隐藏按钮

时间:2017-03-06 12:14:39

标签: javascript jquery button

我想在点击按钮时隐藏按钮。所以在阅读StackOverflow问题和答案后,我创立了这个:

'click .stop' (event) {
        Session.set(this._id + "_spinningRng", true);

        document.getElementsByClassName('pause').style.display = 'none';
        document.getElementsByClassName('kill').disabled = true;
        document.getElementsByClassName('cmdLogs').disabled = true;

但是3条线都不起作用。

你知道吗?

1 个答案:

答案 0 :(得分:1)

我建议你包含jQuery,因为事情变得容易多了:)

然后你会这样做;

$('.stop').on('click', function() {
    $('.pause').hide(); // hides a element with the class pause (adds display:none;)
    $('.play').show(); // reveals a hidden element with class play
});

https://www.w3schools.com/jquery/jquery_get_started.asp