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 8264951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:37:59+00:00 2026-06-08T04:37:59+00:00

Please can you help me, i don´t find a solution. I have a function

  • 0

Please can you help me, i don´t find a solution. I have a function with arguments and want to pass this function to a jquery bind-event:

function countChars23 (chars) {
    var thi = $(this);
    var len = $(this).val();
    if (len.length >= chars) {
        len = len.substring(0, 22);
        thi.val(len);

    }
}

Calling the function don´t work:

$('#name').bind('keyup', countChars23(10));

This don´t work either:

$('#name').bind('keyup', function() {
    countChars23(10);
}

This don´t work either:

$('#name').keyup(function() {
    countChars23(10);
}

Many Thanks for your help!

  • 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-08T04:38:01+00:00Added an answer on June 8, 2026 at 4:38 am

    You can use the data parameter to .bind:

    $('#name').bind('keyup', {chars: 10}, countChars23);
    

    and then in your function replace the declared parameter with event and put this in the first line:

    var chars = event.data.chars;
    

    EDIT the reason your second and third attempts (with the extra function wrapper) don’t work is because they don’t set this properly. You would have had to have called it like this:

    $('#name').keyup(function() {
        countChars23.call(this, 10);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please can someone help? I have the following code which uploads a file to
Im a beginner to css, please can someone help me get this element to
i was searching SO for help on this, but i can't seem to find
Would you please help me to find out better solution for the following issue...
Any body please can please help me, how to center a JFrame on Mac.
I am new to HTML and Javascript. Please someone can help me with the
I wonder whether someone can help me please. I'm using the following script to
Can you please help to derive a regular expression that matches the bold-italics portion
Can you please help me to write a sed command to remove the price
Can somebody please help me with the if statement and arrays. So for example

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.