繁体   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