Obtenir le texte selectionné dans une iframe(jQuery Ajax)
mariouma22
Messages postés5Date d'inscriptiondimanche 27 juillet 2014StatutMembreDernière intervention10 août 2014
-
Modifié par mariouma22 le 10/08/2014 à 16:39
@karamel
Messages postés1855Date d'inscriptionvendredi 9 mai 2008StatutModérateurDernière intervention18 avril 2024
-
11 août 2014 à 16:38
Bonjour,
pour obtenir le texte selectionné dans une iframe j'ai ecrit ce code:
var window = $(document).getElementById('idFrame').contentWindow.window, t = '', document = $(document).getElementById('idFrame').contentWindow.document;
if (window.getSelection) { t = window.getSelection(); } else if (document.getSelection) { t = document.getSelection(); } else if (document.selection) { t = document.selection.createRange().text; }