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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:21:23+00:00 2026-06-07T06:21:23+00:00

i use a jquery for a input box to validate content of that i

  • 0

i use a jquery for a input box to validate content of that
i person who has worked before me make a file that name is comoon.js and that file support all another files.but when i write this code on (document).ready(function() like this

    $(document).ready(function()
{
    $('#validate').keyup(function(){
      var i = $('input');
      (/http:\/\//).test(i.val()) && i.val(i.val().replace('http://',''));
    });

});

and i have input box like this

<input type="text" id="validate"  class="right" name="linkurl" maxlength="150" size="130"/>

but it doesnt work on this button what should i do and what is the problem and i know that js file loaded of all pages …

  • 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-07T06:21:25+00:00Added an answer on June 7, 2026 at 6:21 am

    Assuming you have more than one input on your page the problem is this line:

    var i = $('input');
    

    …which sets i to a jQuery object containing all inputs on the page. Try instead:

    var i = $(this);
    

    …which will set i to a jQuery object containing just the element the event occurred on.

    (Your code works when there is only one input.)

    If the input in question is created dynamically after page load you’ll have a second issue: you can’t bind an event handler to an element that doesn’t exist yet, but you can use a delegated event handler:

    $(document).ready(function()
    {
        $(document).on("keyup", '#validate', function(){
          var i = $(this);
          (/http:\/\//).test(i.val()) && i.val(i.val().replace('http://',''));
        });
    });
    

    Where ideally you’d replace document in $(document).on("keyup", '#validate', ... with the closest ancestor of “#validate” that exists on page load. If you’re using a version of jQuery less than 1.7 use .delegate() instead of .on() (see the jQuery API doco for more info).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jQuery UI Dialog Box that contains a jQuery UI Autocomplete input
I have a HTML page. I want to have a input box, that has
I have a regular text-box: <input type=text> I use jQuery to handle key-related events:
i want to use user input in jquery dialog input box to be used
I need to use jquery to add and delete input fields based on user's
I am trying to use jquery's parents/siblings to find particular input elements but I
I have an input box: <input class=longboxsmall type=text name=number value=/> And I want to
I am trying to use Jquery Dialog box in place of Java script standard
I'm using an HTML form to input data. I use jQuery to refresh every
I have a input box, and I would like to use vbscript or javascript

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.