logo
logo

Change ID and Class Names

Beginner

Change ID and Class Names

Write a function that takes two parameters: an element and an object containing new ID and class names. The function should change the element's ID and class names to the new values. For example, if the function is called with an element that has the ID "my-div" and the class name "blue", and the object { id: "new-id", class: "red" }, it should change the ID to "new-id" and the class name to "red".

Console
Submit
Solution
00:00