Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

Toggle field on/off deopending on the length of another field

I am looking for some javascript to hide/show a div depending on the length of the string in a separate input field. For example; if the input field is the first line of an address and is less than 5 characters then hide the submit button.
1 Solution
Ray PaseurCommented:
Please see http://iconoun.com/demo/temp_cdjohn31.php
<!DOCTYPE html>
<html dir="ltr" lang="en-US">

<!-- SEE http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28507149.html -->

<meta charset="utf-8" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
        len = $("#addr").val().length;
        if (len > 4){

<title>HTML5 Page in UTF-8 Encoding</title>

<input id="addr">
<input id="subm" type="submit" value="OK, Go!" />


Open in new window

This is about the minimum needed to do the trick.  Please post back if you have any questions.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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