/    Sign up×
Community /Pin to ProfileBookmark

Generated HTML question

Hello,

this may be a trivial question but I really need help.

I am using javascript .innerhtml function which is inserting table into <p id=”something”></p> like this
document.getElementById(‘something’).insertHTML=result;

where result have html code of the table.

This works just fine. But when I execute page in browser and click to view page source <p id=’something’> doesn’t contain anything ? , but my variable result is nicely printed on the page.

Can I do something about this?

to post a comment
JavaScript

11 Comments(s)

Copy linkTweet thisAlerts:
@FangFeb 08.2009 — Download the WebDeveloper Toolbar for Firefox or the Web Accessibility Toolbar for IE, both have the option to View Generated Source.
Copy linkTweet thisAlerts:
@22ivan22authorFeb 08.2009 — thnx for the input. Basically I have a different problem. After that code is generated i need to manipulate it with the jquery like this:

$(function() {

$('tr.parent')
.css("cursor","pointer")
.attr("title","Click to expand/collapse")
.click(function(){
$(this).siblings('.child-'+this.id).toggle();
});
$('tr[@class^=child-]').hide().children('td');

});


this code is doing expanding and collapsing rows. It's working fine with other tables but with generated one won't work.
Copy linkTweet thisAlerts:
@FangFeb 08.2009 — Re-run the function after inserting the table.
Copy linkTweet thisAlerts:
@22ivan22authorFeb 08.2009 — And how can I do that?
Copy linkTweet thisAlerts:
@FangFeb 08.2009 — Didn't you write the function to do the expand/collapse?
Copy linkTweet thisAlerts:
@22ivan22authorFeb 08.2009 — Yes, and that function is in the page that hasn't got the table code yet. Table is generated after click on a button. Expand/collapse work only on the tables which are already drew in the page. I want to reload that function after the table is generated.
Copy linkTweet thisAlerts:
@FangFeb 08.2009 — So re-run the function
Copy linkTweet thisAlerts:
@22ivan22authorFeb 08.2009 — So re-run the function[/QUOTE]

And how can I re-run the function?
Copy linkTweet thisAlerts:
@FangFeb 08.2009 — How did you do it the first time?
Copy linkTweet thisAlerts:
@22ivan22authorFeb 08.2009 — Function is located at the end of file. First the page code is executed then my function. I never re-run it
Copy linkTweet thisAlerts:
@FangFeb 08.2009 — Re-run it after loading the new table.
×

Success!

Help @22ivan22 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...