23 February 2023

How to add "Not Found" text into empty div or by specific class in jquery?

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>

No comments:

Post a Comment

How to add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...