I’m new to jQuery. I’m trying to use this code:
var ThisTableWrapper = $('#switch1').parent().next();
var ThisTable = $(ThisTableWrapper > '.table-data');
But it doesn’t seems to work.
What is the correct way to write that in one line?
I’ve tried something like this – but with no success
$( $('#switch1').parent().next();) > .table-data);
Any help will be much appreciated.
HTML HERE: html code
jQuery selectors must always be strings, or other jQuery / DOM elements, but not a combination / concatenation of both.
The second line should be:
Or in one line:
The documentation provides a list of possible selectors and traversal methods.
As @DanielB points out in his comment, this is just to fix the syntax, it does not mean that the correct elements are selected. This depends on your actual HTML which you did not post.