简体   繁体   中英

Open / Close Div Tags After Submit

I am just learning Jquery and I am trying to do something that I think is possible, but I am not sure.

I have a div tag that contains a form and it's target is an Iframe. When a user clicks submit on the form and the Iframe is loaded, I want to hide the div tag that contains the form and I want to show two div tags that are hidden.

Thanks for the help.

Here are the div tags. I also posted the div tag container that loads an animation while the Iframe is loading incase that would be helpful.

<div id="form" style="visibility:visible">
    <form id="form" method="post" target="iframe1" convert.php">
        <input id="element_1" type="text" maxlength="255" value="http://"/> 
        <input id="saveForm" type="submit" name="submit" value="submit" />
    </form>
</div>

<div id="hidden1" style="visibility:hidden">
    <p>hidden content</p>
</div>

    <div id="hidden" style="visibility:hidden">
    <p>hidden content</p>
</div>


<div id="frameWrap">
    <img id="loader1" src="ajax_loader_blue_512.gif" alt="loading gif"/>  
      <iframe id="iframe1" name="iframe1" src="1.html"  onload="hideLoading()"> 
      </iframe>
</div>

This is the script I am using for loading the animation:

<script>
    $(document).ready(function () {
    $('#iframe1').on('load', function () {
    $('#loader1').hide();
});
});
// in ready()
$('#form_710370').submit(function(){$('#loader1').show();return true;});
</script>

suggestion:- use different ids for div and form

$('#form').submit(function()

{
    $(this).parent().hide()
    $('#hidden1, #hidden').show()
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM