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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:07:56+00:00 2026-05-24T06:07:56+00:00

trying to do something pretty obvious really but its kinda not making any sense

  • 0

trying to do something pretty obvious really but its kinda not making any sense / not working for me …

The idea is simple, when the document is loaded $(document).ready() get all input elements that have attribute type=”text” on them and add the css class “textbox” …

<script type="text/javascript">
    $(document).ready(function () {
        var textboxes = $(":input [type = 'text']");
        textboxes.each().addClass("textbox");
    });
</script>

Any ideas why this doesn’t work ?? …

EDIT:

Wow .. still have a lot to learn about jquery-isms … starting to love jquery though 🙂 it’s simplicity really does the trick.

  • 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-24T06:07:56+00:00Added an answer on May 24, 2026 at 6:07 am
    $(document).ready(function () {
        $("input[type='text']").addClass("textbox");
    });
    

    No need for the colon before the element input.

    $("input[type='text']") will reference all elements so no need for an each()

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

Sidebar

Related Questions

Totally stumped here. Trying something pretty easy, but it's not working: $(input.input1, textarea.input1).focus(function(){ $(this).addClass(input2).removeClass(input1);
I am trying something very simple, but for some reason it does not work.
I'm trying to something pretty simple but am having headaches with it. I'm pretty
I'm trying to do something pretty simple, but I can't figure out how to
OK I'm pretty sure this is something blindingly obvious but I'm not finding it.
I think what I'm trying to do is pretty simple, and I'm really not
I'm trying something like this, but this example does not work. jsObj = {};
actually I thought I was trying something really simple. ControllerClassNameHandlerMapping sounded great to produce
i'm trying to do something pretty simple: line = name : bob k, v
This is probably really obvious and simple - but it isn't to me with

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.