.length
propertyThe jQuery .length
property can be used to get or find out the number of characters in a string. You can also use this property to calculate the number of elements in a jQuery object.
Let's take a look at an example to understand how it basically works:
<script>
$(document).ready(function(){
var myStr = " Paragraph of text with multiple white spaces before and after. ";
myStr.length; // Returns 81
$.trim(myStr).length; // Returns 68
myStr.replace(/ /g,'').length; // Returns 53
});
</script>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to add attributes to an HTML element in jQuery
Use the jQuery attr() method You can...Laravel 5.4 Users Authorization With Spatie Laravel-Permission
Today, Laravelcode share with you a very...How to get the Raw SQL Query from the Laravel Query
Hello guys, Sometimes, you may want t...How to convert Excel File data into JSON object in JavaScript?
Today, I will share with you a very smal...How to get the position of an element relative to the parent using jQuery
Use the jQuery position() meth...