Home > Mobile >  DOM manipulation using JS function [closed]
DOM manipulation using JS function [closed]

Time:09-23

I am learning JS and very new to coding.

function querySelection(e){
  console.log(document.querySelector(e));
}
querySelection('h5');
querySelection('#id');
querySelection('.className');
//querySelection('li: last child');

The very last query throws an error (commented). I am very new JS.I am not sure what is wrong in that query?

CodePudding user response:

Change

querySelection('li: last child');

to

querySelection('li:last-child')
  • Related