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>';

Link to comment
Share on other sites

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

   

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.