Click here to Skip to main content
15,892,746 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionHow to use Gride View Pin
Member 112816092-Dec-14 17:25
Member 112816092-Dec-14 17:25 
AnswerRe: How to use Gride View Pin
den2k882-Dec-14 21:30
professionalden2k882-Dec-14 21:30 
QuestionDataTable.js problem with mozilla Pin
Hemant Thaker28-Nov-14 0:03
Hemant Thaker28-Nov-14 0:03 
QuestionHow to set the result variable of a javascript of one div to another div tag Pin
Member 1126811126-Nov-14 23:08
Member 1126811126-Nov-14 23:08 
QuestionFormat var to special format Pin
Member 1056002225-Nov-14 4:48
Member 1056002225-Nov-14 4:48 
AnswerRe: Format var to special format Pin
Richard MacCutchan25-Nov-14 6:56
mveRichard MacCutchan25-Nov-14 6:56 
GeneralRe: Format var to special format Pin
Member 1056002225-Nov-14 20:24
Member 1056002225-Nov-14 20:24 
QuestionGet Content of a Clicked Div in Iframe Pin
ASPnoob21-Nov-14 10:31
ASPnoob21-Nov-14 10:31 
Hi all, I am trying to create a web editor using an Iframe. So basically users can open up a page they want to edit in the Iframe and edit away.

I want to be able to grab the content of any element of a page and then do what I need to with it. I ran into some problems when there are elements embedded in other elements such as a div with children each having no id or class attributes.

I tried to solve this problem by first identifying which element was clicked and give it a temporary id if id did not already have one. Then using the new id get the content (I'm trying to get the text). I tried to implement that idea using the code below but it did not work.
JavaScript
 $('#myiframe').load(function () { //load iframe
  $(this).contents().find("body").on('click', function (event) {
    var a = event.target.tagName;
    var divContent = $("#myiframe").contents().find(a);

    $(divContent).click(function (e) {
        var ClickedElementID = e.target.id;   // Get id of target element
        if (ClickedElementID == "") {         // Check if an element has an id
           e.target.attr('id', 'tempID');     // If target element has no id add one
           var  myText = $('#tempID').text(); // Get text using tempID
           $('#tempID').removeAttr('id');     // Remove temporary id
        }
        else {

          var myText = $(ClickedElementID.text()) // Get text
        }
     });
   }
}


Please help me make the code above work as I intended, thanks in advance.

modified 22-Nov-14 19:12pm.

AnswerRe: Get Content of a Clicked Div in Iframe Pin
Richard Deeming24-Nov-14 2:52
mveRichard Deeming24-Nov-14 2:52 
QuestionDisplay user Location on web app using GPS coordinates Pin
Member 1124572718-Nov-14 20:32
Member 1124572718-Nov-14 20:32 
AnswerRe: Display user Location on web app using GPS coordinates Pin
Anas R Firdousi9-Dec-14 14:37
Anas R Firdousi9-Dec-14 14:37 
QuestionTo Parse a URL Pin
Richard Andrew x6417-Nov-14 19:24
professionalRichard Andrew x6417-Nov-14 19:24 
AnswerRe: To Parse a URL Pin
Kornfeld Eliyahu Peter17-Nov-14 20:01
professionalKornfeld Eliyahu Peter17-Nov-14 20:01 
GeneralRe: To Parse a URL Pin
Richard Andrew x6417-Nov-14 20:10
professionalRichard Andrew x6417-Nov-14 20:10 
QuestionExternal .js file vs. script tags; how does it work? Pin
stevebrulerules17-Nov-14 12:34
stevebrulerules17-Nov-14 12:34 
AnswerRe: External .js file vs. script tags; how does it work? Pin
Peter Leow17-Nov-14 14:06
professionalPeter Leow17-Nov-14 14:06 
Questionfirefox addon. required(sdk/tabs).attach() not working Pin
alborozd17-Nov-14 4:45
alborozd17-Nov-14 4:45 
AnswerRe: firefox addon. required(sdk/tabs).attach() not working Pin
ZurdoDev17-Nov-14 5:23
professionalZurdoDev17-Nov-14 5:23 
QuestionCode Modify for JS Pin
Member 1123853816-Nov-14 13:05
Member 1123853816-Nov-14 13:05 
AnswerRe: Code Modify for JS Pin
Richard MacCutchan16-Nov-14 21:39
mveRichard MacCutchan16-Nov-14 21:39 
QuestionRe: Code Modify for JS Pin
ZurdoDev17-Nov-14 5:24
professionalZurdoDev17-Nov-14 5:24 
QuestionHow to Create HTML Code in PDF Article? Pin
hub sarasota11-Nov-14 19:12
hub sarasota11-Nov-14 19:12 
QuestionSetting the content of an HTML span text to the text of an asp textbox text properity Pin
Stephen Holdorf9-Nov-14 10:04
Stephen Holdorf9-Nov-14 10:04 
AnswerRe: Setting the content of an HTML span text to the text of an asp textbox text properity Pin
Richard Deeming10-Nov-14 4:36
mveRichard Deeming10-Nov-14 4:36 
Questionissue with IE11 via Jquery/Ajax Pin
Rajendra Kumar Katabathuni6-Nov-14 21:14
Rajendra Kumar Katabathuni6-Nov-14 21:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.