Enable on submit button after text entered

Posted on 2004-11-18
Last Modified: 2012-06-21
Ive got a single search field and button.  I want to load the submit button disable by default, and then enable it only if text is entered into the search field.  I also need to disable it again if the text is deleted.  Can this be done with javascript?
Question by:soBC
    LVL 2

    Accepted Solution

    yep, just add a function to the text area onKeyUp="checkIt(this.form)"

    then define checkIt(myForm) as:
    if (myform.textfield.value="") then myform.submitbutton.enabled=false

    that is it... syntax may need a bit a tweaking, but pretty much that will work.

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
    The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

    737 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

    15 Experts available now in Live!

    Get 1:1 Help Now