Jump to content

Recommended Posts

Posted

Hello, I am trying to get a CEF browser to work with buttons used by JQuery. I am able to get the browser to show up no problem, but none of the events associated are firing. For example, I'd like to be able to click on a button and an event fires however, I can't seem to get it to fire my testEvent event. What am I doing wrong here?

// Client side index.js
const localPlayer = mp.players.local;
require('./test/Main.js'); // Main.js file for the client package

 

// Main.js File of client package
var bankBrowser = mp.browsers.new('package://test/index.html');
var showCursor = false;

mp.keys.bind(0x71, false, function() { // F2 Key
    showCursor = !showCursor;
    if (showCursor) {
        mp.gui.cursor.show(true, true);
    } else {
        mp.gui.cursor.show(false, false)
    }
})

mp.events.add("testEvent", () => {
    mp.console.logInfo("Success", true, true);
    bankBrowser.destroy();
})

 

 

require('./Main.js');
$("#nikeCheck").click(() => {
  mp.trigger("testEvent")              
})

 

Posted

Nvm. I'm stupid and didn't include JQuery in my HTML. For anyone with the same issue I figured this out by using CEF debugger and located the issue to be JQuery was not defined so I used a CDN link for it in my HTML.

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...