Solved

HTML form button and input not formatting correctly

Posted on 2012-03-26
3
249 Views
Last Modified: 2012-03-26
I am having some difficulty getting an input button to work.  

In the code below, when I include the button inside the form id="searchform", it aligns correctly as I am looking for, but it does not trigger the onclick action when pressed.

When I include the button outside the form id="searchform", it aligns incorrectly, but it does trigger the onclick action when pressed.

I figure that I need to either make the form react to the button click when the button is inside the form element, or figure out a better way to align the button when I include it outside the form element.

Here is the code:

    <div id="searchbox" align="right">
      <form id="searchform">      	
        <button class="i_magnifying_glass icon small green" value="Go" 
                    onclick="if($('#add_nox').val()!='')loadProperty($('#add_nox').val())" >
       </button>
        <input  id="add_selectx" 
                    style="width:100px; text-align:left" 
                    type="text" 
                    placeholder="Search" 
                    onblur="rollnum=jQuery('#add_nox').val();" />
        <input  id="add_nox" 
                    type="text" 
                    value="" 
                    style="display:none;"/>                       
       </form>
    </div>

Open in new window

Would appreciate any suggestions.  Thank you.
0
Comment
Question by:DanielAttard
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
William Fulks earned 500 total points
ID: 37768501
Could be because you haven't specified a type for the button. Check this out:

http://www.w3schools.com/tags/tag_button.asp
0
 

Author Closing Comment

by:DanielAttard
ID: 37768534
Great work phungy!  Your good deed is done for the day.  Thanks for helping me out.
0
 
LVL 14

Expert Comment

by:William Fulks
ID: 37768692
Thanks!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
manage footer size 4 51
HTML &#0153 2 17
Web forms being filled out by bots 4 31
Checkout Page Input Field not aligned 1 21
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question