Home >Web Front-end >JS Tutorial >jQuery detects the data type of the return value_jquery

jQuery detects the data type of the return value_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 15:50:281267browse

In the code, the data type of the return value must be clearly known to perform correct calculations, or the type of a variable is required. Here is an introduction to how to detect the data type of the return value. The code example is as follows:

<style type="text/css">
div
{
 width:200px;
 height:100px;
 background-color:#660;
} 
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 var width=$("div").css("width");
 alert(jQuery.type(width));
})
</script>

 <div></div>

As you can see from the above code, jQuery.type() can detect data types.

The above is the entire content of this article, I hope you all like it.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn