jquery-confirm
jquery-confirm copied to clipboard
Compability with React js
jquery-confirm version: v3.x.x
I'm submitting a ... (check one with "x") [ ] bug report [ ] feature request [ x] support request
Current behavior: Hello! My request not is a bug, but is a important question for react community. In my project I want to use jquery-confirm, I love his design and all functions, but I can't apply with react. Someone can help me with this?
Expected behavior: The project should show the dialog
Steps to reproduce: I try import the $ jquery operator in my index.js from node modules and the jquery-confirm cdn library in my index.html, but not works
Related code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href='https://fonts.googleapis.com/css?family=Raleway:300,400,600,700|Roboto:300,400,500,700&display=swap' rel='stylesheet'>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.css">
<title>InfoPorcinos</title>
</head>
<body>
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.js"></script>
</body>
</html>
// index.js
import $ from 'jquery'
$.confirm({
title: 'Alert!',
content: 'Simple alert!'
})
and in my console appear this issue
Uncaught TypeError: jquery__WEBPACK_IMPORTED_MODULE_3___default.a.confirm is not a function
at inactiveTime (index.js:102)
at eval (index.js:133)
at commitHookEffectList
Other information:
@moontechnologies2020 I had a similar issue.
I had to install via NPM:
npm install jquery-confirm
And in my React code had to import both jQuery and jQuery confirm:
import $ from "jquery";
import 'jquery-confirm';