console.log( $( "span[dataname='totalEach']" ).val() ); console.log( parseInt( $( "span[dataname='totalEach']" ).text(), 10) );