I want to select a tbody tag with no id or class or tags or whatever...
In CSS I know that I can use the following to select it:
table#header_info > tbody
But how can I achieve the same thing in JavaScript / jQuery? What is the best way?
I want to select a tbody tag with no id or class or tags or whatever...
In CSS I know that I can use the following to select it:
table#header_info > tbody
But how can I achieve the same thing in JavaScript / jQuery? What is the best way?
In jQuery:
var tbody = $('#header_info').children('tbody');
In MooTools:
var tbody = $('header_info').getChildren('tbody');
In DoJo:
var tbody = dojo.query('tbody', '#header_info');
In Raw JS:
var tbody = document.querySelectorAll("#header_info > tbody ");
In Raw JS old version:
var tbody = document.getElementById('header_info').getElementsByTagName('tbody');
And there are many many other JavaScript Selecting Engines and functions that you can use...
Just like CSS, in jQuery...
var tbody = $('#header_info > tbody')
I removed the unnecessary table selector, but you can keep it if you want.
With jQuery you can do:
$("#header_info").children("tbody");
Or:
$("#header_info > tbody");