Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other get selected text into iframe(jQuery,ajax,JSP)

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #178771
    maram22
    Participant

    Hi,
    I have more than 2 weeks working on this thing without find solution.
    Just I want to know if it is possible to get the selected text into iframe without have an idea for the content of the iframe because the content is just an url geted by a search on google…..
    I have tried this code:

    $(document).ready(function(){
         $('#idButton').click(function(){
             var window = $(document).getElementById('idiframe').contentWindow.window,
             t = '',
             document = $(document).getElementById('idiframe').contentWindow.document; 
                if (window.getSelection) 
                { t = window.getSelection(); 
                alert(t);} 
                else if (document.getSelection) 
                { t = document.getSelection();
                alert(t);} 
                else if (document.selection)
                { t = document.selection.createRange().text;
                alert(t);}
    
          else{
                alert('doesnt.work');
            }
         });});

    but it didn’t work!!

Viewing 1 post (of 1 total)
  • The forum ‘Other’ is closed to new topics and replies.