I'm trying to use ALERTIFYJS in react but its alertify alerts are not working. Below is the code
(window.alert is working fine on my browser)
import alertify from 'alertifyjs';
clickHandle = () => {
alertify.alert('Alert Title', 'Alert Message!', function(){
alertify.success('Ok');
});
}
I'm trying to use ALERTIFYJS in react but its alertify alerts are not working. Below is the code
(window.alert is working fine on my browser)
import alertify from 'alertifyjs';
clickHandle = () => {
alertify.alert('Alert Title', 'Alert Message!', function(){
alertify.success('Ok');
});
}
Share
Improve this question
edited Oct 12, 2020 at 6:29
Sultan Aslam
asked Sep 2, 2018 at 14:49
Sultan AslamSultan Aslam
6,2382 gold badges40 silver badges48 bronze badges
7
- what is not working? – Arup Rakshit Commented Sep 2, 2018 at 14:51
- @ArupRakshit alertify alerts – Sultan Aslam Commented Sep 2, 2018 at 14:53
- Any errors in the console that might give you a hint on why it's not working? – Deepak Kamat Commented Sep 2, 2018 at 14:55
- no errors even in console its showing everything ok. if i console alertify its show there is a function alert – Sultan Aslam Commented Sep 2, 2018 at 14:56
- 1 You should add the css file tooo – Ramesh Kithsiri HettiArachchi Commented Oct 30, 2018 at 9:57
2 Answers
Reset to default 14Need to add the css file too. Problem Solved.
import 'alertifyjs/build/css/alertify.css';
Yes, You have to add css file as well.
Here is the process for adding css and importing alertify
import alertify from 'alertifyjs';
import 'alertifyjs/build/css/alertify.css';
or
import * as alertify from 'alertifyjs';
import 'alertifyjs/build/css/alertify.css';
Please note I have tested this code on react js 16.13.1 with restify 1.13.1