Jump to content
xisto Community
denba

How To Change Css Properties Of A Content Loaded Using Ajax?

Recommended Posts

Using a form or specifics links, I can update the content of the div "mydiv" using an Ajax request (mootools 1.2) (var myRequest = new Request({...).
The "imported" content looks like:

<div id="div1">...</div><div id="div2">...</div>...

Once my ajax call is done and completed (content of "mydiv" is replaced as expected) I would like to change some css properties of this "imported content (ie. add a top margin to div2).

I tried to add to
onComplete: function(response) {			$('div1').setStyle('margin-top', '50px');			alert('Request completed successfully.');		}

Nothing occurs but javascript error telling that element div1 is null.
Am I missing something here or what should I do in order to be able to manipulate the "imported" data?

Thanks in advance for your help.
BM
Edited by moderator (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.