[英]calling ajax function show error tUncaught TypeError: $ is not a function using jquery
[英]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.