Solved

HTML form button and input not formatting correctly

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

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 13

Expert Comment

by:William Fulks
ID: 37768692
Thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 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

19 Experts available now in Live!

Get 1:1 Help Now