I want to delete id attribute of element

Asked 1 years ago, Updated 1 years ago, 91 views

I have a question about deleting attributes.
Below is an html statement.
I'd like to delete the id="newsite" in the tag using javascript, what should I do?
I look forward to your kind cooperation.

menu.html

<ons-list-item id="newsitem"
        modify="tappable" class="list_item__line-height"
        onclick="app.slidingMenu.setMainPage('news.html', {closeMenu:true})">
        <i class="fa fa-list fa-lg" style="color:#666"></i>
        &nbsp; News
    </ons-list-item>

javascript html onsen-ui

2022-09-30 16:26

1 Answers

To delete an attribute, run the removeAttribute() method for the element.

varm= document.getElementById("newsiteem");
elm.removeAttribute("id");


2022-09-30 16:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.