Jump to content

Help with CEF onclick


Kamycz3q

Recommended Posts

How i can make onclick event trigger in js?

HTML

            <button id="zakup_glock18" class="zakup_glock18" onload='mtatools._callEvent("onChat", "[1, {\"firstName\":\"John\"}]" );'>Zakup</button>
 

 

 

JS:

var eventHandlers = [];
 
    var MTAUtils = function() {};
 
    MTAUtils.prototype.registerEvent = function(eventNamehandler) {
        eventHandlers[eventName] = handler;
    }
 
    MTAUtils.prototype._callEvent = function(eventNamejsonArgs) {
        var func = eventHandlers[eventName];
        if (!func)
            return false;
 
        func.apply(nullJSON.parse(jsonArgs)[0]);
    }
 
    mtatools = new MTAUtils();
    mtatools._callEvent("onChat""[1, {\"firstName\":\"John\"}]" );*/
Link to comment
  • Administrators

Hello and welcome to the forums @Kamycz3q! Please use the Scripting section in the future when making threads asking for help related to MTA coding. We have moved a few of your threads to the appropriate section, please keep that in mind for future questions you may ask in the forum. There are also some stickied threads in (most) sections which contain guidelines for posting in their section. :)

https://forum.multitheftauto.com/forum/71-scripting/

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...