Add Not Found text into empty div or by specific class in jquery
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var not_found_dt = "<div class='not_found_dt'>Not Found</div>";
var demo_str = $('#demo').text();
demo_str = demo_str.replace(/\s/g, '');
if(demo_str.length == 0){
$('#demo').html(not_found_dt);
}
});
</script>
</script>
</head>
<body>
<div id="demo"></div>
</body>
</html>
Comments
Post a Comment