簡體   English   中英

jQuery TypeError - 顯示不是函數

[英]jQuery TypeError - show is not a function

我有一個按鈕如下:

<button id="onlineusers" style="display: none;">Call User</button>

我需要根據事件顯示按鈕,如下所示:

client.on('stream-added', function (evt) {
  alert("User is online");  
  var stream = evt.stream;
  $('#onlineusers').show();
  console.log("New stream added: " + stream.getId());
  console.log("Subscribe ", stream);
  client.subscribe(stream, function (err) {
    console.log("Subscribe stream failed", err);
  });
});

我正在使用 jQuery (2.0.1),我嘗試了以下操作:

$('#onlineusers').show();

我收到一個錯誤:

類型錯誤:$(...).show 不是函數

類型錯誤:$(...)show 不是函數

我是一個 javascript 新手。 請求幫助!!!

您可以刪除“呼叫用戶”按鈕的“樣式”屬性,

$('#onlineusers').removeAttr('style');

所有代碼:

client.on('stream-added', function (evt) {
  alert("User is online");  
  var stream = evt.stream;
  $('#onlineusers').removeAttr('style');
  console.log("New stream added: " + stream.getId());
  console.log("Subscribe ", stream);
  client.subscribe(stream, function (err) {
    console.log("Subscribe stream failed", err);
  });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM