Fix the problem: Bootstrap form form and carriage return conflict

Source: Internet
Author: User
Tags button type

Tag: Success lock hold control Enter to resolve bar source code input

"Problem" Sometimes we want to add our own carriage return event to the form form of bootstrap, but I press enter always inexplicably refresh my page.

  This is the form and address bar length:

  

  Type 2, enter, the page is refreshed, the address bar becomes like this:

  

"Cause" in bootstrap, you use an input box that will bind your carriage return event (I'm not sure where the source code is.) );

More than one input entry box, this condition does not occur.

"Workaround 1" Add a hidden form:

<formclass="Navbar-form Navbar-left"role="Search"> <divclass="Form-group"> <input type="text"Placeholder="Please enter ID"Id="Searchvalue" class="Form-control"/> </div> <input type="text"Value="resolving conflicts between Bootstrap and Ajax asynchronous submission forms"Hidden/> <button type="Button" class="btn Btn-default"onclick="Gotosearch ()"> Search </button> <button type="Button"onclick="gotocreate ()" class="btn btn-success"> Create </button> </form>
Workaround 1-Add a hidden form

Solution 2 Change the form to a Div

See Original: Http://www.cnblogs.com/blog-cq/p/5812644.html

<Divclass= "Navbar-form navbar-left"role= "Search">        <Divclass= "Form-group">            <inputtype= "text"placeholder= "Please enter ID"ID= "Searchvalue"class= "Form-control"/>        </Div>        <Buttontype= "button"class= "Btn Btn-default"onclick= "Gotosearch ()">Search</Button>        <Buttontype= "button"onclick= "gotocreate ()"class= "Btn btn-success">Create</Button>    </Div>
Workaround 2-Change form to Div

"The new question."

Bootstrap, where is the source of the binding event? I haven't found it yet.

Fix the problem: Bootstrap form form and carriage return conflict

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.