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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:19:56+00:00 2026-06-03T01:19:56+00:00

In jQuery I can do something like: $(‘#example’).click(); What is the equivalent in raw

  • 0

In jQuery I can do something like:

$('#example').click();

What is the equivalent in raw Javascript? I have tried the following:

document.getElementById('example').click();

But that doesn’t seem to work. Thanks!

  • 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-03T01:19:58+00:00Added an answer on June 3, 2026 at 1:19 am

    I use this in my framework:

        function fireEvent() {
            var eventType = null, i, j, k, l, event,
                einstellungen = {
                'pointerX': 0,
                'pointerY': 0,
                'button': 0,
                'ctrlKey': false,
                'altKey': false,
                'shiftKey': false,
                'metaKey': false,
                'bubbles': true,
                'cancelable': true
            }, moeglicheEvents = [
                ['HTMLEvents', ['load', 'unload', 'abort', 'error', 'select', 'change', 'submit', 'reset', 'focus', 'blur', 'resize', 'scroll']],
                ['MouseEvents', ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mousemove', 'mouseout']]
            ];
    
            for(i=0,j=moeglicheEvents.length;i<j;++i) {
                for(k=0,l=moeglicheEvents[i][1].length;k<l;++k) {
                    if(arguments[1] === moeglicheEvents[i][1][k]) {
                        eventType = moeglicheEvents[i][0]; i = j; k = l;
                    }
                }
            }
    
            if(arguments.length > 2) {
                if((typeof arguments[2]) === 'object') {
                    change(einstellungen, arguments[2]);
                }
            }
    
            if(eventType === null) {
                throw new SyntaxError('Event type "' + arguments[1] + '" is not implemented!');
            }
    
            if(document.createEvent) {
                event = document.createEvent(eventType);
    
                if(eventType === 'HTMLEvents') {
                    event.initEvent(arguments[1], einstellungen.bubbles, einstellungen.cancalable);
                } else {
                    event.initMouseEvent(arguments[1], einstellungen.bubbles, einstellungen.cancelable, document.defaultView,
                        einstellungen.button, einstellungen.pointerX, einstellungen.pointerY, einstellungen.pointerX, einstellungen.pointerY,
                        einstellungen.ctrlKey, einstellungen.altKey, einstellungen.shiftKey, einstellungen.metaKey, einstellungen.button, arguments[0]);
                }
    
                arguments[0].dispatchEvent(event);
            } else {
                einstellungen.clientX = einstellungen.pointerX;
                einstellungen.clientY = einstellungen.pointerY;
    
                event = document.createEventObject();
    
                event = extend(event, einstellungen);
    
                arguments[0].fireEvent('on' + arguments[1], event);
            }
        }
    

    argument 1 is the element, the second argument the event, the third (optional) options.

    Sorry, i forgot to rewrite some parts:

    _.isObject() to (typeof arguments[2]) == 'object'

    and _.change to change and this function is needed:

    function change() {
        var name;
    
        for(name in arguments[1]) {
            if((typeof arguments[1][name]) === 'object') {
                if((typeof arguments[0][name]) === 'undefined') {
                    arguments[0][name] = {};
                }
    
                change(arguments[0][name], arguments[1][name]);
            } else {
                arguments[0][name] = arguments[1][name];
            }
        }
    
        return arguments[0];
    };
    

    Edit:

    In your case it would be fireEvent(document.getElementById('example'), 'click');

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

Sidebar

Related Questions

How can I delay actions between keypress in jQuery. For example; I have something
in jQuery you can write something like $(selector).bind('click', function(e) { // something was true
I suppose the following code: jQuery(#mybutton).click(function(){ //do something }); How could I recall to
I'm looking for a jquery plugin slider that can do something like this: http://hitmo-studio.com/contact.html#business-query
In jQuery we can do like... $('.button').click( function() { $(this).hide(); } ); But we
I know that in jQuery you can use something like $(.cssClass) to get all
Can I use JQuery to query the Trackpad? So I can do something like
By using jquery ajax function, I can do something like: $.ajax({ url: url, type:
I can do something like this: $(document).ready(function(){ $(.schedule_link).colorbox({width:95%, innerHeight:344, iframe:true}); }); to attach the
I'm looking for something similar to this: Active navigation with jQuery - can't apply

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.