locked
how to delete a "div" element declared in app's settings flyout pane??

    Question

  • i had declared a "div" element in my app's settings flyout pane, i am trying to delete it when a function is fired but the "div" element is not getting deleted, please help me , my code is below

    <div class="win-ui-light win-header" >
                   <button type="button" onclick="WinJS.UI.SettingsFlyout.show()" class="win-backbutton"></button>
                   <div id="root" class="win-label">Removable Div</div>
                </div>

    javascript code is:

    var root = document.getElementById("root");

    root.parentNode.removeChild(root);

      
    Friday, July 25, 2014 2:58 PM

Answers

  • Hi Kranthi88,

    Before answer your question I would like to know where you put the delete code? As I can see from your code, the button click fire a SettingFlyout.show() but not fire any code to delete the root div.

    I don't know what is your scenario, but following code works fine with me:

        <script>
            function buttonClick() {
                WinJS.UI.SettingsFlyout.show();
                var root = document.getElementById("root");
                root.parentNode.removeChild(root);
            }
    
        </script>
    
        <div class="win-ui-light win-header">
            <button type="button" onclick="buttonClick()" class="win-backbutton"></button>
            <div id="root" class="win-label">Removable Div</div>
        </div>
    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by kranthi88 Monday, July 28, 2014 5:06 AM
    Monday, July 28, 2014 1:47 AM
    Moderator