Created
October 10, 2011 15:47
-
-
Save DasLampe/1275652 to your computer and use it in GitHub Desktop.
JQuery select block before current main block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**HTML CODE | |
<div class="edit_content_options"><a class="edit_link">Edit</a></div> | |
<div> | |
<div>Edit block, with event</div> | |
</div>*/ | |
function find_parent(current_block) | |
{ | |
var parent, searchblock, edit_option; | |
parent = current_block.parent(); | |
searchblock = parent.find('div[class="edit_content_options"]'); | |
if(searchblock.length == 0) | |
{ | |
return find_parent(parent); | |
} | |
else | |
{ | |
edit_option = current_block.prev(); | |
return edit_option.find('a[class="edit_link"]').attr('href'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment