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, 2022 in Web Development by gaurav
• 23,260 points
3,385 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, 2022 by rajatha
• 7,680 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, 2022 in Web Development by gaurav
• 23,260 points
307 views
0 votes
0 answers

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

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

Jul 28, 2022 in Web Development by gaurav
• 23,260 points
500 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
641 views
0 votes
0 answers

jQuery Validate plugin not validating an element that's not a form input

I need to validate with jQuery Validation ...READ MORE

Aug 18, 2022 in Web Development by gaurav
• 23,260 points
1,581 views
0 votes
1 answer

jQuery mouse click counter

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

answered Jun 16, 2022 in JQuery by rajatha
• 7,680 points
1,064 views
0 votes
0 answers

jQuery mouse click counter

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

Aug 2, 2022 in Web Development by gaurav
• 23,260 points
449 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,510 points
1,015 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,880 points
14,368 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, 2022 in Web Development by rajatha
• 7,680 points
528 views
0 votes
1 answer

jQuery Load function not loading the file

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

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