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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:48:47+00:00 2026-05-31T23:48:47+00:00

var brands = document.getElementsByName(brand); for(var brand in brands){ $(input[name=’brand’]).eq(brand).click(function(){ alert(hello22); loadDataFN(1); }); } This

  • 0
var brands = document.getElementsByName("brand");
for(var brand in brands){
    $("input[name='brand']").eq(brand).click(function(){
                        alert("hello22");
                        loadDataFN(1);                
                });
}

This code is not executing in ie6,
Any help would be appreciated.

  • 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-31T23:48:48+00:00Added an answer on May 31, 2026 at 11:48 pm

    The problem is likely that you are trying to use a for-in construct to iterate over a numeric array. This often won’t give expected results. Use an incremental for loop instead:

    var brands = document.getElementsByName("brand");
    
    // Use an incremental for loop to iterate an array
    for(var i=0; i<brands.length; i++){
        $("input[name='brand']").eq(brands[i]).click(function(){
                            alert("hello22");
                            loadDataFN(1);                
                    });
    }
    

    However,

    after seeing the first part of your code, the loop appears unnecessary. You should only need the following, since you are assigning the same function to all brand inputs.

    // These will return the same list of elements (as long as you don't have non-input elements named brand)
    // though the jQuery version will return them as jQuery objects
    // rather than plain DOM nodes
    var brands = document.getElementsByName("brand");
    $("input[name='brand']");
    

    Therefore, the getElementsByName() and loop are not necessary.

    $("input[name='brand']").click(function() {
           alert("hello22");
           loadDataFN(1);                
    });
    

    for-in loops are used for iterating over the properties of an object, not over the elements of an array.

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

Sidebar

Related Questions

var thumbs = document.getElementsByTagName(img); for (var i=0; i<thumbs.length; i++) { Core.addEventListener(thumbs[i], click, function() {alert(i);});
How to remove spaces in a string? For instance: Input: '/var/www/site/Brand new document.docx' Output:
when I trying to run following code. var result = from c in db.brand
var query1 = urlencode($('input[name=searchTerm1]').val()); //user1 var query2 = urlencode($('input[name=searchTerm2]').val()); //user1 var rpp = 20;
var query1 = urlencode($('input[name=searchTerm]').val()); //user1 $.getJSON('http://twitter.com/friends/ids.json?screen_name='+ query1 +'&jsoncallback=?', function(data){ $('content').append(''+data.length+''); }); This is a
var UI$Contract$ddlForm_change = function() { //'this' is currently the drop down that fires the
#&q=car&category=Car%20Audio%2CAccessories&brand= I borrowed a this function from a previous question asked on SO: function
I have a large array in this format: var cars = [{brand:Honda,year:2002},{brand:Toyota,year:2000},{brand:Subaru,year:2009}]; The array
is there any mistake in this validation??? var $validate = array( 'brand_id' => array(
I have the following function: var id = 10; var type = Type A;

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.