hasClass does not work as expected
See original GitHub issueThis is a (multiple allowed):
- bug
- feature-discussion (RFC)
I want to test if any (at least one) element in my list has the class .bingo. I have a 5 li-tags and 1 tag is associated with class .bingo:
var containBingo = $$('#mylist li').hasClass('bingo');
this will always return “false”, even one tag in my list is associated with class “.bingo”.
I have to do this to get “containBingo” to “true”
$$('#app_menu li').each(function() {
if ($$(this).hasClass('bingo')) {
console.log('BINGO');
containBingo = true;
}
});
However, the f7 docs says this about hasClass():
Determine whether any of the matched elements are assigned the given class.
So according to the docs it must return true, because there is one element with class .bingo.
Is this a bug?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
jquery "hasClass()" not working? - Stack Overflow
I need the div on the bottom to hide when the word "click" is.. well.. clicked. It adds a class to the middle...
Read more >hasClass not working for some reason... - jQuery Forum
Hi, I've been pulling my hair out trying to figure out what is wrong with my code here: // Add attributes to external...
Read more >If element hasClass, is not working - Codecademy
Why is this not working:? **HTML** First item Second item Third item Fourth item **jQuery** $(document).ready(function(){ if( $("li").hasClass("active") ) ...
Read more >hasClass returns false unexpectedly in v3 #1177 - GitHub
I've tried multiple combinations, like datePicker.getDOMNode().hasClass but these are not working either. Thanks in advance for help!
Read more >How to use hasClass function in JQuery - Javascript - Tabnine
QUnit.test('should remove "collapsed" class from target when collapse is shown via manual invocation', ; assert.expect(1) ; var done = assert. ; var $target...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey,
I don’t think it’s a bug!! Though that totally depend upon your context of class “Bingo”…😁
On Tuesday, September 13, 2016, Zander notifications@github.com wrote:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.