Solved

HTML form button and input not formatting correctly

Posted on 2012-03-26
3
248 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can i modify my File download link ? 6 49
JavaScript: Issue with onClick 5 36
remove background quote mark from widget 6 23
How to count in a table in php 22 18
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

896 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now