Hi,

I would like to reuse a twitter bootstrap component. For that I need to 
create the following markup:

http://twitter.github.com/bootstrap/javascript.html#modals


   1. <div class="modal hide" id="myModal">
   2. <div class="modal-header">
   3. <button type="button" class="close" data-dismiss="modal">×</button>
   4. <h3>Modal header</h3>
   5. </div>
   6. <div class="modal-body">
   7. <p>One fine body…</p>
   8. </div>
   9. <div class="modal-footer">
   10. <a href="#" class="btn" data-dismiss="modal">Close</a>
   11. <a href="#" class="btn btn-primary">Save changes</a>
   12. </div>
   13. </div>


I have tried to create the structure using DOM.createDiv(), like this:

class BootstrapDialog(HTML):
    def __init__(self, title = None, content = None):
        modal = DOM.createDiv()
        modal.setAttribute("id","myModal")
        modal.setAttribute("class","modal")
        header = DOM.createDiv()
        header.setAttribute("class","modal-header")
        body = DOM.createDiv()
        body.setAttribute("class","modal-body")
        footer = DOM.createDiv()
        footer.setAttribute("class","modal-footer")
        buttons = HTML('<a href="#" class="btn btn-primary">Save 
changes</a><a href="#" class="btn" data-dismiss="modal">Close</a>')
        footer.add(buttons)
        modal.add(header)
        modal.add(body)
        modal.add(footer)
        HTML.__init__(self, modal)

The problem is that I get the following error:

Uncaught TypeError: Object [object HTMLDivElement] has no method 'add' 

How can I recreate a <div> structure in pyjs?

Thanks,
Daniel

Reply via email to