Netcrawle wrote:
I'm having major trouble with regards to having to work with inline
javascript-code generated by the Apache Wicket-framework for Java
I've had some difficulty too getting Wicket to play nice with jQuery or
vice-versa, and often done similar tricks. You code looks fine. One
trick I try sometimes is to save a copy of the HTML into the Wicket
application to run at the same location as the dynamic page. Then I can
play with the JS and HTML of that page without worrying about the
dynamic nature of Wicket.
$('.btn.submit').click(function(){
$(this).prev().click();
});
Somehow i -think- the submit is not triggering because of the
references to (this) in the inline-code but i'm not sure.
That shouldn't matter. The click will happen in the context of the
correct object. This should be a simple demonstration:
$(document).ready(function() {
$(".test").click(function() {
$(this).prev().click();
});
});
<a href="#" onclick="alert(this.innerHTML);">Link 1</a>
<a href="#" class="test">Link 2</a>
Either link will alert "Link 1".
One thought. Are you absolutely certain that "prev()" is returning the
correct element? If you are manipulating the DOM at all, you need to
check this not only in the original Wicket markup, in the generated HTML
document, and in Firebug or some tool that shows the dynamic DOM.
Cheers,
-- Scott