the .pbgmain
will return the following array.
var all = [{sher: "some text"},{sher: "some text"},{sher: "some text"}];
You just need this (and you don't need to use jQuery!):
const elements = document.querySelectorAll( '.pbgmain' );
const elementArray = Array.from( elements );
const elementTexts = elementArray.map( e => e.textContent.trim() );
const asArrayOfObjects = elementTexts.map( text => ( { sher: text } ) );
console.log( asArrayOfObjects );
This can be shortened to this if you want to be more succint:
const asArrayOfObjects = Array.from( document.querySelectorAll( '.pbgmain' ) ).map( e => ( { sher: e.textContent.trim() } );
console.log( asArrayOfObjects );
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…