question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to trigger minicolors change event manually

See original GitHub issue

Hi there,

I want to trigger change event manually as I am passing the values dynamically like shown below $('#elemid').minicolors('value', '#ff0000'); above code modified to explain the problem, after this event I want to trigger the change event so as to update my object as well as the html (targeted element where the background color will change)

Thanks in advance

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
claviskacommented, Apr 16, 2020

jQuery(‘#pcolor’).val(‘#ffee00’); jQuery(‘#pcolor + .minicolors-swatch > span’).css(“background-color”, ‘#ffee00’);

You should never try to set the value this way. Messing with internals will result in unreliable behavior. The correct syntax for setting the value per the API is:

// Method 1
$('#pcolor').minicolors('value', '#fc0');

// Method 2
$('#pcolor').minicolors('value', { color: '#fc0', opacity: .5 });
0reactions
arvindpdmncommented, Apr 16, 2020

That’s awesome. Clean solution. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I trigger a change event manually? - jquery
Try this $('select#BrandNames').trigger('change');. or var event = jQuery.Event('change'); event.target ...
Read more >
How can I trigger an onchange event manually in javascript?
Triggering the event manually − const e = new Event("change"); const element = document.querySelector('#test') element.dispatchEvent(e);.
Read more >
jQuery MiniColors 2.1
This is useful for preventing the change event from firing frequently as the user drags the color picker around. The default value is...
Read more >
Documentation - LayerSlider
LayerSlider's documentation covering common topics such as installation, product activation, updating, and troubleshooting.
Read more >
Flash Point: Fire Rescue – Tragic Events - BoardGameGeek
Classification Edit ... Flash Point: Fire Rescue - Tragic Events is an expansion for Flash Point: Fire Rescue, a cooperative game for 1-6...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found