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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:34:16+00:00 2026-05-23T12:34:16+00:00

I found that in Google+ Project’s page that buttons are all made from divs

  • 0

I found that in Google+ Project’s page that buttons are all made from divs like:

<div role="button"></div>  

I’d like to know, is this just for semantic purposes, or does it influence the style or event handling of the <div>?

I tried to simulate a button "click" with the jQuery click event, but it didn’t work.

  • 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-23T12:34:16+00:00Added an answer on May 23, 2026 at 12:34 pm

    It tells accessibility (and other) software what the purpose of the div is. More here in the draft role attribute specification.

    Yes, it’s just semantic. Sending a click event to the button should work.


    An earlier version of this answer (back in 2011) said:

    …but jQuery’s click function doesn’t do that; it triggers only the event handlers that have been hooked up to the element with jQuery, not handlers hooked up in other ways.

    …and provided the sample code and output below.

    I cannot replicate the output now (two years later). Even if I go back to earlier versions of jQuery, they all trigger jQuery handlers, DOM0 handlers, and DOM2 handlers. The order isn’t necessarily the same between a real click and jQuery’s click function. I’ve tried jQuery versions 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5, 1.5.1, 1.5.2, 1.6, and more recent releases such as 1.7.1, 1.8.3, 1.9.1, and 1.11.3 (the current 1.x release as of this writing). I can only conclude that it was a browser thing, and I don’t know what browser I was using. (Right now I’m using Chrome 26 and Firefox 20 to test.)

    Here’s a test which shows that indeed, jQuery handlers, DOM0 handlers, and DOM2 handlers are all (as of this writing!) triggered by jQuery’s click:

    jQuery(function($) {
      var div;
    
      $("<p>").text("jQuery v" + $.fn.jquery).appendTo(document.body);
    
      // Hook up a handler *not* using jQuery, in both the DOM0 and DOM2 ways
      div = document.getElementById("theDiv");
      div.onclick = dom0Handler;
      if (div.addEventListener) {
        div.addEventListener('click', dom2Handler, false);
      } else if (div.attachEvent) {
        div.attachEvent('onclick', dom2Handler);
      }
    
      // Hook up a handler using jQuery
      $("#theDiv").click(jqueryHandler);
    
      // Trigger the click when our button is clicked
      $("#theButton").click(function() {
        display("Triggering <code>click</code>:");
        $("#theDiv").click();
      });
    
      function dom0Handler() {
        display("DOM0 handler triggered");
      }
    
      function dom2Handler() {
        display("DOM2 handler triggered");
      }
    
      function jqueryHandler() {
        display("jQuery handler triggered");
      }
    
      function display(msg) {
        $("<p>").html(msg).appendTo(document.body);
      }
    
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <div id="theDiv">Try clicking this div directly, and using the button to send a click via jQuery's <code>click</code> function.</div>
    <input type='button' id='theButton' value='Click Me'>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Morning all, I know that this sounds like a simple referencing problem from the
I recently found a cool little project that I would like to download the
After trying to setup my site for Google Webmaster Tools I found that my
I found that you can't read from some sites using Python's urllib2(or urllib). An
Is it compulsory that all dynamic dropdown menus must be called from the database?
I have a project which would like to utilize the Google Guava libraries (on
I've a C++ project that I'm currently porting from VS2008 to VS2010. When I
I have found a XML file through google search that will help me for
Some months ago I found a project-management / time-estimation software that would ask you
After searched in google, found that jackson has better performance than gson, i plan

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.