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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:23:04+00:00 2026-06-06T20:23:04+00:00

What is the best way to remove all tabindex attributes from html elements? GWt

  • 0

What is the best way to remove all tabindex attributes from html elements? GWt seems to put this attribute even it is not set anywhere in the code. It sets tabindex to -1.

I have the code below as working but it is tedious because I have to search every element according to its tag name and that slows the page loading. Any other suggestions? I’d prefer the solution not use javascript, as I am new to it.

        NodeList<Element> input =  this.getElement().getElementsByTagName("input");

        if(input.getLength()>0)
        {
            for(int i=0; i<=input.getLength(); i++)
            {

                    input.getItem(i).removeAttribute("tabIndex");

            }

        }
        NodeList<Element> div =  this.getElement().getElementsByTagName("div");

        if(div.getLength()>0)
        {
            for(int i=0; i<=div.getLength(); i++)
            {

                    div.getItem(i).removeAttribute("tabIndex");

            }

        }
  • 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-06T20:23:05+00:00Added an answer on June 6, 2026 at 8:23 pm

    I finally figured it out.

    I tried Javascirpt/jquery but they couldn’t remove tabindexes because the page was not fully rendered yet – my panels are placed programmatically after window.load. What I did is make use of the RootPanel.class of gwt (which was being used already, but I didn’t know).

    The task: to get rid of all tabindex with -1 value, add type=”tex/javascript” for all script tags, type=”text/css” for style tags and out an alt to all img tags. These are all for the sake of html validation.

    I am not sure this is the best way, it sure does add up to slow loading, but client is insisting that I do it. So here it is:

     RootPanel mainPanel = RootPanel.get(Test_ROOT_PANEL_ID);
            Widget widget = (Widget) getEntryView();
            mainPanel.add((widget));
    
            // Enable the view disable the loading view. There should always be
            // the loading panel to disable.
            Element mainPanelelement = DOM.getElementById(Test_ROOT_PANEL_ID);
            Element loadingMessage = DOM.getElementById(LOADING_MESSAGE);
    
    
           Element parent = loadingMessage.getParentElement();
    
            if(parent!=null)
            {
    //i had to use prev sibling because it is the only way that I know of to access the body //tag that contains the scripts that are being generated by GWT ex.bigdecimal.js
    
        Element body = parent.getPreviousSibling().getParentElement();
                if(body!=null)
                {
                     NodeList<Element> elms = body.getElementsByTagName("*");
                     if(elms.getLength()>0)
                             {
                                Element element=null;
                                for(int i=0; i<=elms.getLength(); i++)
                                {
                                    if(elms.getItem(i)!=null)
                                    {
                                        element = elms.getItem(i);
                                        if(element.getTagName().compareToIgnoreCase("script")==0)
                                            element.setAttribute("type", "text/javascript");
                                        else if(element.getTagName().compareToIgnoreCase("style")==0)
                                            element.setAttribute("type", "text/css");
                                        else if(element.getTagName().compareToIgnoreCase("img")==0)
                                        {
                                            if(element.getAttribute("alt")=="")
                                                    element.setAttribute("alt", element.getAttribute("title")!=" " ? element.getTitle() : " " );
                                        }
                                        else 
                                        {
                                            if(element.getTabIndex()<=0)
                                                element.removeAttribute("tabindex");
                                        }
    
                                    }
                                }
                             }
                }
    
            }
            DOM.setStyleAttribute((com.google.gwt.user.client.Element) loadingMessage, "display", "none");
            DOM.setStyleAttribute((com.google.gwt.user.client.Element) mainPanelelement, "display", "inline");
    
            // Change cursor back to default.
            RootPanel.getBodyElement().getStyle().setProperty("cursor", "default");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best way to remove all the special characters from a string
What is the best way to remove all merge fields from a word 2010
What is the best way to remove all classes and all ids from all
What is the best way to remove all spaces from a string in SQL
According to Best way to remove from NSMutableArray while iterating? , we can't remove
I was just wondering what the best way to remove the white space from
Good morning ! What is the best way to remove duplicate records from grid
What is the best way to remove the first comma from the following string?
Yesterday I put the following question: The best way to remove array element by
What is the best way to remove duplicate lines from large .txt files like

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.