Semantic-Org/Semantic-UI · info

The method you called is not defined

Error message

The method you called is not defined

What it means

NOTE: unlike the other Semantic modules, rating.js's invoke() hits the unknown-method branch but does NOT call module.error(error.method) — it simply returns false (line 407-409). So although this string is registered in settings.error, a developer will never see it at runtime; an unknown $('.foo').rating('badMethod') call is a silent no-op. The string documents intent only.

Source

Thrown at src/definitions/modules/rating.js:471

  name          : 'Rating',
  namespace     : 'rating',

  slent         : false,
  debug         : false,
  verbose       : false,
  performance   : true,

  initialRating : 0,
  interactive   : true,
  maxRating     : 4,
  clearable     : 'auto',

  fireOnInit    : false,

  onRate        : function(rating){},

  error         : {
    method    : 'The method you called is not defined',
    noMaximum : 'No maximum rating specified. Cannot generate HTML automatically'
  },


  metadata: {
    rating    : 'rating',
    maxRating : 'maxRating'
  },

  className : {
    active   : 'active',
    disabled : 'disabled',
    selected : 'selected',
    loading  : 'loading'
  },

  selector  : {
    icon : '.icon'

View on GitHub (pinned to 597843ab84)

Solutions

  1. Verify the method name (valid rating behaviors: 'get rating', 'set rating', 'disable', 'enable', 'destroy')
  2. Be aware this module silently ignores unknown methods — add your own debug logging around the call if you need feedback

Example fix

// before
$('.ui.rating').rating('setRating', 3);  // silently ignored
// after
$('.ui.rating').rating('set rating', 3);
Defensive patterns

Strategy: validation

Validate before calling

var RATING_BEHAVIORS = ['get rating','set rating','disable','enable','destroy'];
function isRatingBehavior(name) { return RATING_BEHAVIORS.indexOf(name) !== -1; }
if (isRatingBehavior(method)) {
  $('.ui.rating').rating(method, arg);
} else {
  // rating.js silently ignores unknown methods, so log explicitly yourself
  console.warn('rating: unknown behavior', method);
}

Type guard

function isRatingMethod(name) {
  return /^get rating$|^set rating$|^(disable|enable|destroy)$/.test(name);
}

Prevention

When it happens

Trigger: Calling $('.ui.rating').rating('unknownMethod'). Nothing is logged and nothing happens — no feedback, unlike sibling modules.

Common situations: Calling a non-existent rating behavior and expecting a console error like the other modules; debugging a dead call with no output.

Related errors


AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13). Data as JSON: /api/errors/641ec62749c694b2. Report an issue: GitHub.