Loading content into parent element using jquery
I have a div element with a specific id
<div id='someid'>
<input type='submit' class='edit' value='Edit'>
</div>
When the button is clicked, I want to select the parent element (in this case the div element) and load the content into it. I tried:
$(document).ready(function(){
$(".edit").click(function(){
var id = $(this).parent().get(0).id;
$(id).load("contentpage");
});
});
But that doesn't work, presumably because I'm not picking the right parent? If I print out the id variable it has the correct value ("someid"), but I think $ (id) is where I am going wrong?
+2
source to share