I kept banging my head on the wall with this code, and finally decided to come here for help.
I have the following markup.
<h3 class="element-title">Summary <span class="cs">THIS IS AN IMAGE</span></h3>
<textarea class="edit-mode" id="summary-<?php echo($randomId); ?>"><?php echo(br2nl($erow['summary'])); ?></textarea>
And focal jQuery.
$(".cs").live('click',function() {
var element=$(this);
var sc=element.prev(1).next('.edit-mode'); alert(sc.toSource());
});
What I'm trying to do is when clicked so that it returns an identifier or even a text box object below it. Unfortunately, the page is very dynamic, so I need to select ".edit-mode" in the class name, so linking to ID is not an option. If that were the case, I would do it.
I think the problem is that the range is inside the tag <h3>, so I need to get out of it and then next(), but that doesn't work.
Can anyone help?
Thanks in advance
Alex
source
share