Search Results

Search found 1 results on 1 pages for 'gneandr'.

Page 1/1 | 1 

  • using .append to build a complex menu

    - by gneandr
    To build a menu block which should be switchable with hide/unhide of the menu items, I'm using .append html. The code idea is this: navigat += '<h3 class="infoH3"> <a id="' + menuID +'"' + ' href="javascript:slideMenu(\'' + menuSlider + '\');">' + menuName + '</a></h3>'; navigat += '<div id="' + menuSlider + '" style="display:none">'; navigat += ' <ul>'; navigat += ' <li>aMenu1</li>' navigat += ' <li>aMenu2</li>' navigat += ' <li>aMenu3</li>' navigat += ' </ul>'; navigat += '<!-- menuName Slider --></div>'; $("#someElement").append (navigat); This is doing well .. so far. But the point is:: I use JS to read the required menu items (eg. 'aMenu1' together with title and/or link info) from a file to build all that, eg. for 'aMenu1' a complex is composed and $("#someElement").append(someString) is used to add that the 'someElement'. At the moment I build those html elements line by line. Also OK .. as far as the resulting string has the opening and closing tag, eg. "<li>aMenu2</li>". As can be seen from above posted code there is a line "<div id="' + menuSlider + '" style="display:none">". Appending that -- AFAIS -- the .append is automatically (????) adding "</div>" which closes the statement. That breaks my idea of the whole concept! The menu part isn't included in the 'menuSlider '. QQ: How to change it -- NOT to have that "</div" added to it?? Günter

    Read the article

1