donglei2022 2014-08-31 18:51
浏览 22

当我在我的页脚中点击我的新闻订阅按钮时,我会到我的页面顶部[关闭]

When I click in my newsletter subscribe button in my footer Im going to the top of my page.

I can have my sucess message my error messages but Im going always to the top of my page. And I dont want this because I want that usre see the feedback message without scroll down to my footer.

Do you see why this happening and how can I fix this?

<form action="" name="newsletter" method="post" enctype="multipart/form-data">
    <div id="email_newsletter_container">
        <input type="text" id="email" value="<?php if(isset($_POST['email'])) echo $email; ?>" name="email" placeholder="Insert your email..." required/>
        <input type="hidden" name="newsl_sub" value="subscribe" />
        <button class="btnn" type="submit" name="subscribe"><span>Subscribe</span></button>
    </div>
</form>
  • 写回答

2条回答 默认 最新

  • douhui3760 2014-08-31 18:55
    关注

    When you put action="" the action will reload the page. If you put action="#newsletter" it should take the user to the section of the page that contains the form when the form is submitted. You may also want to add id="newsletter" to the form to ensure compatibilities.

    评论

报告相同问题?