Project Description:
In according to the following rules, I need a simple javascript that on form submit hide a div content and shows another one.
on success.form: <form id="form_promotion" class="ss_promotion_form" method="post" action="/facebook/form/6320768" novalidate="novalidate">
Hide this div : <div id="content1" class ="instruction">xxxxxxx</div>
Show this div : <div id="content2" class = "thanks"> xxxx </div>
these are the Event Handling Code:
Events Reference
Event: success.form
Descrption: User successfully submits a Custom Form or Promotion widget.
Parameters:
- response -> The response object returned by the Ajax call that submitted the form.
- form -> A jQuery reference to the form being submitted.
-----------------------------------------------------------------
The general steps for handling events are:
Add a Code widget to your tab and, optionally, change the name to “Event Handler” (or something equally descriptive).
Paste the following code into the widget:
<script type="text/javascript">
$(function(){
$('#WIDGET_ID').bind('EVENT.NAME', function(event) {
// code for handling the event goes here
});
// repeat $('#WIDGET_ID')... block for additional event handlers
});
</script>
Replace WIDGET_ID with the CSS ID of the widget where the event comes from.
Replace EVENT.NAME with the actual name of the event you are handling (see Events Reference below).
If desired, add additional event handlers.
--------------------------------------------------
Currently, the Voting widget doesn’t offer an option to automatically share an item that is voted on. By adding the code below to a Code widget, we can add this feature:
<script type="text/javascript">
$(function() { // <- This function gets executed when the document is loaded and ready
// create a handler for the success.vote event
$('.ss_voting').on('success.vote', function(event, entry) {
// search for a share link within the entry that was voted on
var share_link = $('.share_link', entry);
// test if the share link exists
if (share_link.length > 0) {
// a link was found, so "click" it for the user to invoke the share prompt
share_link.click();
}
});
});
</script>