{"record":{"id":"09ba6f5e2a57c513","repo":"Semantic-Org/Semantic-UI","slug":"the-element-you-specified-could-not-be-found","errorCode":null,"errorMessage":"The element you specified could not be found","messagePattern":"The element you specified could not be found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/modules/modal.js","lineNumber":1022,"sourceCode":"  // called after hide animation\n  onHidden   : function(){},\n\n  // called after approve selector match\n  onApprove  : function(){ return true; },\n\n  // called after deny selector match\n  onDeny     : function(){ return true; },\n\n  selector    : {\n    close    : '> .close',\n    approve  : '.actions .positive, .actions .approve, .actions .ok',\n    deny     : '.actions .negative, .actions .deny, .actions .cancel',\n    modal    : '.ui.modal'\n  },\n  error : {\n    dimmer    : 'UI Dimmer, a required component is not included in this page',\n    method    : 'The method you called is not defined.',\n    notFound  : 'The element you specified could not be found'\n  },\n  className : {\n    active     : 'active',\n    animating  : 'animating',\n    blurring   : 'blurring',\n    inverted   : 'inverted',\n    legacy     : 'legacy',\n    loading    : 'loading',\n    scrolling  : 'scrolling',\n    undetached : 'undetached'\n  }\n};\n\n\n})( jQuery, window, document );\n","sourceCodeStart":1004,"sourceCodeEnd":1038,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/modules/modal.js#L1004-L1038","documentation":"Emitted by Modal's attachEvents(selector, event) (modal.js:200) when the given selector matches zero elements — there is nothing to bind the show/hide toggle to. It is a console.error (modal.js:822), not thrown.","triggerScenarios":"$('.ui.modal').modal('attach events', '#nonexistent') where '#nonexistent' matches nothing at call time.","commonSituations":"Wrong/typo selector for the trigger button, trigger element rendered after modal init (AJAX/SPA), selector scoped outside where jQuery looks.","solutions":["Verify the selector matches an element before calling 'attach events'.","Attach events after the trigger element is in the DOM.","Bind manually instead: $('#btn').on('click', () => $('.ui.modal').modal('show'))."],"exampleFix":"// before\n$('.ui.modal').modal('attach events', '#opn'); // typo -> notFound\n// after\n$('.ui.modal').modal('attach events', '#open');","handlingStrategy":"validation","validationCode":"// Verify the trigger selector matches before attaching modal events.\nfunction attachModalTrigger($modal, selector){\n  if ($(selector).length === 0) {\n    throw new Error('Modal trigger not found for selector: ' + selector);\n  }\n  $modal.modal('attach events', selector);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the trigger element exists in the DOM before 'attach events'.","For late-rendered triggers, bind manually: $('#btn').on('click', () => $modal.modal('show')).","Prefer stable selectors (id) over fragile CSS paths."],"tags":["modal","selector","events"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}