Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

KTui Select


Is there an event to enable/disable a select using the provided attribute : data-kt-select-disabled from javascript?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (2)

Hi Jvmvl C

Sorry for the delay. The data-kt-select-disabled attribute is only processed during component initialization. Changing it after initialization won't update the component state. Use the enable() and disable() methods for runtime control.

  1. Get the KTSelect instance
  2. Enable/Disable programmatically
  3. Listen to events:
// Get the select element
const selectElement = document.querySelector('#my-select');
const selectInstance = KTSelect.getInstance(selectElement);

// Listen to state changes
selectElement.addEventListener('kt-select:disabled', function() {
    console.log('Select disabled');
});

selectElement.addEventListener('kt-select:enabled', function() {
    console.log('Select enabled');
});

// Toggle disabled state
function toggleSelect() {
    if (selectInstance._config.disabled) {
        selectInstance.enable();
    } else {
        selectInstance.disable();
    }
}
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(