<p data-id="test">123</p> <script> var html=$("p[data-id='test']").html(); console.log(html) //123 </script>