Outils pour utilisateurs

Outils du site


webdev:javascript:basics

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
webdev:javascript:basics [13/12/2018 19:42]
dolo
webdev:javascript:basics [02/12/2020 21:20] (Version actuelle)
dolo [Basics]
Ligne 1: Ligne 1:
 ====== Basics ====== ====== Basics ======
 +  * [[https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery#answer-12034334|Escape HTML]]
 +  * [[https://www.sitepoint.com/delay-sleep-pause-wait/|Delay sleep pause wait]] - or lack thereof [[https://www.w3schools.com/js/js_timing.asp|Doc]]
   * ...   * ...
  
Ligne 65: Ligne 67:
 <Code linenums> <Code linenums>
 var size = Object.keys(myObj).length; var size = Object.keys(myObj).length;
-</Code> 
- 
-=== Copying to clipboard === 
-  * [[https://www.w3schools.com/howto/howto_js_copy_clipboard.asp|Copy to clipboard]] + [[https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript|SO]] 
- 
-You can [[https://www.w3schools.com/jsref/met_textarea_select.asp|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. 
- 
-<Code linenums> 
-////////////////////////////////////// 
-// 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> 
 </Code> </Code>
webdev/javascript/basics.1544726575.txt.gz · Dernière modification: 13/12/2018 19:42 de dolo