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

  • Home
  • SEARCH
  • 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 8087293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:43:51+00:00 2026-06-05T18:43:51+00:00

What wrong with this validation: Jquery: $(document).ready(function(){ $(#addcmd).attr(disabled,disabled); $(#cmdstxt).keypress( function(event){ var txt=$(#cmdstxt); if( txt.val().length

  • 0

What wrong with this validation:

Jquery:

$(document).ready(function(){

    $("#addcmd").attr("disabled","disabled");

    $("#cmdstxt").keypress( function(event){
        var txt=$("#cmdstxt");



        if( txt.val().length > 8 ){
            $("#addcmd").attr("disabled",false);

        }
        else{
        $("#addcmd").attr("disabled","disabled");   
        }
    });       });

Html code:

<textarea class="element"  name="about" id="cmdstxt"></textarea>
<input type="button" id="addcmd" value="Add comment"  />

Here my problem is the button enable only after 10 char disabled only when 7 char in text box how can I overcome this issue?

  • 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-06-05T18:43:53+00:00Added an answer on June 5, 2026 at 6:43 pm

    Live Demo

    You have wrong spelling of length in condition for enabling button.

    $(document).ready(function(){
    
        $("#addcmd").attr("disabled","disabled");
    
        $("#cmdstxt").keypress( function(event){
            var txt=$("#cmdstxt");
            //alert(txt.val().length);  this alert successfully 
            if( txt.val().length > 7 ){
                $("#addcmd").removeAttr("disabled");
            }
        });      });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jQuery validation control in my form. It's working: $(#webform-client-form-45).submit(function(){ if($(#edit-submitted-name-surname).val() ==
Not sure what I'm doing wrong. I'm using the jQuery Validation plugin. This is
What's wrong with this function: function() { $.get('/controller/action', function(data) { $('#temporaryPhotos').text(data); } ); return
What is wrong with this function... The function intends to remove the specified leading
I have some jQuery code that, without it in the document it passes validation
I've got the rules defined below for a page: $(document).ready(function() { $.validator.setDefaults({ submitHandler :
I am having problems with jQuery validation of a form. This is my javascript
Using this jQuery validation plugin. http://www.benjaminkeen.com/software/rsv/jquery/index.php I want to validate a checkbox group with
at the moment i'm using this validation plugin: ( http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/ ) but when it
Whats wrong with this code? -(void) drawRect:(CGRect) rect { CGContextRef c = UIGraphicsGetCurrentContext(); if

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.