Home > Web Front-end > JS Tutorial > body text

jQuery detects the data type of the return value_jquery

WBOY
Release: 2016-05-16 15:50:28
Original
1225 people have browsed it

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>
Copy after login
<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>

Copy after login
 <div></div>
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template