Ceci est une ancienne révision du document !
// Trigger $('.volume').on('mousemove', function(e) { console.log(e); console.log(e.pageX); $('.volume').trigger('mousedown', [e.pageX] ); }); // We get the value as $('.volume').on('mousedown', function(e, altPageX) { console.log(e); console.log(altPageX); });
Throttle : Similar to debouncing but ensure a minimum execution of the function every fixed time
Using jQuery's .one() can also work.
if( typeof google_step != 'undefined') { // ... }
var tmpDisable = {}; var lastTmpDisable = {}; lastTmpDisable = tmpDisable; // Any change made to any of these object will be on both because they're references // If we declare it this way a new object is created for(var key in tmpDisable) { lastTmpDisable[key] = tmpDisable[key] }
var size = Object.keys(myObj).length;
You can select all the text in a textarea, and also fill it with the variable you want before. The textarea need to be visible for the text to be selected, and you can't juste hide it just after.
////////////////////////////////////// // Javascript $(document).ready(function() { $('.copy-ids').on('click', function(e) { var to_copy = ''; $('.id_to_copy').each(function(index) { to_copy = to_copy + $(this).html() + ' ; '; }); $('.paste-ids').html(to_copy).css('visibility', 'visible'); $('.paste-ids')[0].select(); document.execCommand("copy"); // TODO : indicateur visuel }); }); ////////////////////////////////////// // HTML <input class="copy-ids" type="button" value="Copier les ids"/> <textarea class="paste-ids"></textarea>