Reputation: 25062
I am trying to select a table inside a form. Here is my html:
<div id="switcher-panel">
<form accept-charset="UTF-8" action="user/1/advancement" method="post">
<table class="table table-hover">
<thead>...<thead>
<tbody>...</tbody>
</table>
</form>
</div>
I can easily select the div "switcher-panel" with $('#switcher-panel')
, but when I try to drill down to the table through the form with $('#switcher-panel' 'form')
I get an Unexpected String
error with a type of unexpected_token_string
. I thought I had a pretty decent grasp on Jquery, but I am at a lost here. Is there a way to pass through the form or select the form that I am missing?
Upvotes: 1
Views: 1507
Reputation: 148150
You do not need to put form
in single quotes
again.
Change
$('#switcher-panel' 'form')
To
$('#switcher-panel form')
Upvotes: 1
Reputation: 1610
Try
$('#switcher-panel').find('form')
What you are trying is not a legal selector. This will find the form
element which is the child of the div
.
You can also try $('#switcher-panel form')
or $('#switcher-panel').children('form')
which are pretty much the same things
Upvotes: 1
Reputation: 145428
Use this:
$("#switcher-panel form")
or this:
$("#switcher-panel").find("form");
Otherwise, it is invalid JavaScript code.
Upvotes: 2