I've this snippet of code, pretty working. But trying to delete the comments between
<apex:form>
, I notice an unexpected behaviour : the page reloads when I click any button, making it impossible to use the form tag . Can anyone explain why? (my final wish would be to have some apex:commandButton> , that needs to be into an apex:form)
<apex:page >
<style>
.test {color:red}
#change_me {
position: absolute;
top: 100px;
left: 400px;
font: 24px arial;}
#move_up #move_down {
padding: 5px;}
</style>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
<script>
j$ = jQuery.noConflict();
j$(document).ready(function() {
j$("#move_down").click( function() {
j$("#change_me").animate({top:300},2000);
});
j$("#move_up").click(function(){
j$("#change_me").animate({top:100},2000);
});
});
</script>
<!-- <apex:form> -->
<apex:pageBlock id="theBlock">
<button id="move_down">Move Down</button>
<button id="move_up">Move Up</button>
<div id="change_me"><span class="test">TEST</span></div>
</apex:pageBlock>
<!-- </apex:form> -->
</apex:page>