Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

HTML form button and input not formatting correctly

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
DanielAttard
Asked:
DanielAttard
  • 2
1 Solution
 
William FulksSystems Analyst & WebmasterCommented:
Could be because you haven't specified a type for the button. Check this out:

http://www.w3schools.com/tags/tag_button.asp
0
 
DanielAttardAuthor Commented:
Great work phungy!  Your good deed is done for the day.  Thanks for helping me out.
0
 
William FulksSystems Analyst & WebmasterCommented:
Thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now