[jQuery] How to reduce this code by chain them up?
Hello,
I have a div ( id="rightheader") and inside there is a table. The
following code replace all content of the table with empty space and
then remove the table header.
var $templateTable = $("div#rightheader").clone();
$("tbody > tr > td > div ", $templateTable).html(" ");
$("thead",$templateTable).remove();
I feel it might be unnecessary, but I can't figure out how to chain up
the statements.
I tried
var $templateTable = $("div#rightheader")
.clone()
.("tbody > tr > td > div ").html(" ")
.("thead").remove();
Got an error
then tried
var $templateTable = $("div#rightheader")
.clone()
.find("tbody > tr > td > div ").html(" ")
.find("thead").remove();
but that just doesn't produce anything.
Sorry, I'm a real beginner on JQuery, any pointer is greatly
appreciate it.
Thanks