Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4079984
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:52:17+00:00 2026-05-20T17:52:17+00:00

I have been trying everything to try and solve this myself, but cannot find

  • 0

I have been trying everything to try and solve this myself, but cannot find any solutions on google or my beginner php skills are not up to the task. So please can someone show me how I can make the form submit ONLY if people have written 15 words or more. Any suggestions would be very much appreciated. Below is the css, javascript and html.

#container { 
    background: #ededed; 
    border: 1px solid #ddd; 
    margin: 0 auto; 
    padding: 10px;
    position: relative;
    width: 638px;
}

.error { color: #f00; }

ol.forms { list-style: none; overflow: hidden; }
ol.forms li { float: left; margin-bottom: 12px; width: 100%; }
ol.forms label { cursor: pointer; display: block; }
ol.forms textarea {
    border: 1px solid #ddd;
    float: left; 
    font: 14px/1.5em Georgia, Times, serif; 
    height: 120px; 
    margin-right: 5px;
    overflow-y: auto; 
    padding: 5px;
    width: 500px; 
}
ol.forms textarea:focus { border: 1px solid #000; }
ol.forms div.wordCount { float: left; font-size: 20px; line-height: 30px; }

#quick50 {
    background: #fff;
    border: 1px solid #ddd;
    font-size: 11px;
    left: 5px; 
    padding: 5px;
    position: fixed; 
    width: 188px; 
}

$(document).ready(function() {
    $("[class^='count[']").each(function() {
        var elClass = $(this).attr('class');
        var description = 0;
        var maxWords = 0;
        var countControl = elClass.substring((elClass.indexOf('['))+1, elClass.lastIndexOf(']')).split(',');

        if(countControl.length > 1) {
            description = countControl[0];
            maxWords = countControl[1];
        } else {
            maxWords = countControl[0];
        }

        $(this).after('<div class="wordCount"><strong>0</strong> Words</div>');
        if(description > 0) {
            $(this).siblings('.wordCount').addClass('error');
        }

        $(this).bind('keyup click blur focus change paste', function() {
            var text = jQuery.trim($(this).val()).replace(/\s+/g," ");
            var numWords = text.split(' ').length;
            if($(this).val() === '') {
                numWords = 0;
            }   
            $(this).siblings('.wordCount').children('strong').text(numWords);

            if(numWords < description || (numWords > maxWords && maxWords != 0)) {
                $(this).siblings('.wordCount').addClass('error');
            } else {
                $(this).siblings('.wordCount').removeClass('error');    
            }

        });

    });
});

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Word Count</title>
<link href="wordcount.css" type="text/css" rel="stylesheet" media="screen,projection" />
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="wordcount.js"></script>
</head>

<body>
<div id="container">
    <h1>jQuery Word Count</h1>


    <div class="quickContain">
    <div id="quick50">
        <h2>50 words for quick copying</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam leo orci, porta eget, tincidunt sit amet, sagittis id, turpis. Aenean sed metus at leo ullamcorper dapibus. Duis vitae risus dignissim lectus dapibus faucibus! In porttitor, ante non adipiscing ultricies, magna velit blandit dui, a tempus ligula dolor eu orci? Sed.</p>
    </div>
    </div>

    <ol class="forms">
        <form action="submitcontent.php" method="post">

        <li><label for="minWord">Min Word Textarea <em class="help">(15 words or more)</em></label>
            <textarea onkeyup="limitWords(this,5);" name="minWord" class="count[15,0]" id="minWord"></textarea>
        </li>


        <input type="submit" value="Submit Content"  onclick="return doSubmit()" />
        </form>
    </ol>


</div>


</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:52:18+00:00Added an answer on May 20, 2026 at 5:52 pm

    Off the top of my head, something like this?

    <textarea id="some-textarea" onkeypress="activateSubmit();">
    </textarea>
    <input type="submit" value="Submit" id="submit-button" disabled="disabled">
    

    And correspondingly somewhere:

    <script>
      function activateSubmit(){
        var len = $('#some-textarea').val().split(" ").length;
        if(len >= 15){ //15 words, hardcoded, probably change this to maxwords, or whatever.
          $('#submit-button').removeAttr('disabled');
        }
        else{
          $('#submit-button').attr('disabled', 'disabled');
        }
      }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to solve this problem all day, I googled a lot,
I have been trying to work out the bug on this but can't seem
I have been trying to figure this out for the past week and everything
I have been trying to figure out how all this validation works, but I
I have been trying to figure this problem out without asking for help, but
I have tried contacting tech support with this question, but it has been over
I have been trying to register 3 hotkeys. I followed this example (or this
I have been Trying to figure this out for some time now. I have
I have been trying pretty much everything to get my live wallpaper to stop
I have been trying to use localstorage to store Jquery-min but I am unable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.