toaster clear does not work inside a jQuery function

0 votes

I'm using Angular toaster messages. I use toaster.clear('*') to clear a toaster message and show the next toaster message. This works fine in my other situations.

However here it does not work. I clear the previous toaster message and change the text of the toaster, but the message changes only when I hover over it.

$("#pageColorPallette").change(function() {
  if ($scope.questionNumber == 1) {
    selectedcoler = $("#pageColorPallette").spectrum("get");
    selectedhexacoler = selectedcoler.toHexString();
    toaster.clear('*');
    var content = document.getElementById("editableTextArea");
    content.style.backgroundColor = selectedhexacoler;
    if (selectedhexacoler == '#ffffff') {
      if ($scope.attempts < 3) {
        $scope.addMarksGeneric($scope.activityThreeMarks, 10);
      }
      toaster.clear('*');
      toaster.pop({
        type: 'info',
        title: 'step 2',
        body: ' body of step two message',
        toasterId: 2
      });
      $scope.questionNumber = $scope.questionNumber + 1;
    } else {
      $scope.deductMarksGeneric($scope.activityThreeMarks, 5);
      toaster.pop({
        type: 'error',
        title: 'try again',
        body: 'please try again.',
        toasterId: 2
      });
    }
  } else {
    $scope.deductMarksGeneric($scope.activityThreeMarks, 5);
    toaster.pop({
      type: 'error',
      title: 'try again',
      body: ' Please continue according to the steps.',
      toasterId: 2
    });
  }
});

Aug 4 in Web Development by gaurav
• 17,580 points
11 views

1 answer to this question.

0 votes

The error - "TypeError: $.toast is not a function" is telling you that the method toast() is not present in your JS file.

The most probable cause of this error is because you may be referencing some jQuery plugin in your website. But the plugin is not present in your website. You can correct by adding the plugin in your website to correct this problem.

answered Aug 5 by rajatha
• 7,040 points

Related Questions In Web Development

0 votes
0 answers

Jquery Masonary and item filtering does not work together

I am using a small js filter ...READ MORE

Jul 25 in Web Development by gaurav
• 17,580 points
12 views
0 votes
0 answers

jQuery(...).iris is not a function

I am trying to implement color picker ...READ MORE

Jul 28 in Web Development by gaurav
• 17,580 points
12 views
0 votes
0 answers

TypeError: this.client.incrementMaxListeners is not a function

I'm making a command for my discord ...READ MORE

Dec 29, 2020 in Web Development by anonymous
• 120 points
322 views
0 votes
1 answer

How to download a file by jQuery.Ajax?

Hello @kartik, You don't need to do this ...READ MORE

answered Sep 18, 2020 in Web Development by Niroj
• 82,740 points
5,606 views
0 votes
1 answer

jQuery mouse click counter

You can use jQuery's toggleClass function for that: $(" ... ...READ MORE

answered Jun 16 in JQuery by rajatha
• 7,040 points
77 views
0 votes
0 answers

jQuery mouse click counter

I need to color a table in ...READ MORE

Aug 2 in Web Development by gaurav
• 17,580 points
6 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,500 points
308 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
8,840 views
0 votes
1 answer

jquery - is not a function error

In Wordpress jQuery.noConflict() is called on the jQuery file ...READ MORE

answered Aug 4 in Web Development by rajatha
• 7,040 points
9 views
0 votes
1 answer

jQuery Load function not loading the file

The jQuery load() method allows HTML or ...READ MORE

answered Jun 29 in Web Development by rajatha
• 7,040 points
143 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP