Reputation: 36
I'm trying to modify the width css property of a div using dajax in django. I've tried every variation I can think of with no success. I am using dajax successfully for many other things, mostly for "innerHTML" manipulation.
Here is an example of things I've tried...
Here is a simple div that I want to change the width of
<div id="mysillydiv" style="width: 1px;">some stuff</div>
Here are some dajax functions I've tried...
# does not work
dajax.assign('#mysillydiv', 'css.width', '50px')
# nope, this isn't it either
dajax.assign('#mysillydiv', 'style.width', '50px')
You get the idea. I just need to know what the attribute is to access that width property. :)
Thank you so much.
Upvotes: 1
Views: 337
Reputation: 318
I'm new to dajax, but according to their list of API calls, it looks like you'd have two options.
Either use assign to modify the style attribute:
dajax.assign('#mysillydiv', 'style', 'width:50px')
Or, use CSS classes instead of inline CSS styles:
dajax.add_css_class('#mysillydiv', 'largersize')
And handle #mysilldiv.largersize in your CSS file...
Upvotes: 1