我知道原因,但不知道如何解决(jQuery)
下一个代码用于在用户sign_up时显示弹出模式,但它会崩溃我的下一个代码。 我怎么能覆盖这个?
if($('.alert').html().indexOf('Welcome! You have signed up successfully.') != -1) $('#congrats').show();
应该显示详细信息的其他部分不再显示。
$(".sub a").click(function() { $(this).siblings("div").show("fast"); });
来自视图的代码:
Chrome控制台出错:
Uncaught TypeError: Cannot call method 'indexOf' of null
好人(Rob W)对此说了些什么:
The error is caused by the fact that .html() returns null when the jQuery collection consists of zero DOM elements.
我的通知/提醒的HTML:
Signed out successfully.