i need javascript code to count the number of div tags in a code with same id and assign same value for div tags with same id

i know how to do it in jquery but not in native javascript...

var numberDiv = jQuery("div").size(); or var numberDiv = jQuery("div").length;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.