1

Trying to get the element through DOM accessor in amp-script

Tried to get element by classanme,id and queryselector but couldnot get element

var blogs =  document.getElementById('home-blog-cards');

                                        

Expected the element but got some other data

Mohan Singh
  • 1,142
  • 3
  • 15
  • 30

2 Answers2

2

when using amp-script, you can get the elements inside amp-script tag, because querySelector is currently partially supported.

Check the official documentation: amp-script docs

Marco Túlio
  • 106
  • 4
0

Try updating :

const blogs =  document.getElementById('home-blog-cards');
Gaurav Jeswani
  • 4,410
  • 6
  • 26
  • 47
vishal vanpariya
  • 101
  • 2
  • 13