Jump to content

cannot find the right selector for use in jquery


stijn0713

Recommended Posts

How can i select the id of the div using the add image using jquery

 

i tried something like this:

 

$(document).ready(function(){

$('table td a.add').click(function(){

var form_id = $((this).parent() div).attr('id');

 

$content .= "<tr id =".$row_enquetes['ID'].">";
 $content .= '<td>'.$row_enquetes['title'].'<a href="#" class="add"><img title="add" src="images/add.png"/></a><a href="#" class="delete"><img title="delete" src="images/delete.png"/></a>';
 $content .= '		<div style="height:25px" class= "q_form" id="enq_"'.$row_enquetes['ID'].'"> <form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
     $content .= '			<input type="hidden" name="ID_enquete" value="'.$row_enquetes['ID'].'" size="32" />';
 $content .= '			<input type="text" name="new_question" value="" size="32" />';
 $content .= '			<input type="submit" name="add_question" value="Voeg toe" />';
 $content .= '		</form></div></td>';
 $content .='</tr>';

siblings() versus children():

 

<div class="parent">
    <div class="child"></div>
    <div class="child"></div>
</div>
<div class="parent">
    <div class="child"></div>
</div>

 

[*]There are two "parent" divs and 3 "child" divs. 

[*]The 'parent's are siblings of eachother

[*]The 'child's are children of the 'parent's

[*]The two 'child' divs in the first 'parent' are siblings of eachother, but not the third

   

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.