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

jQuery检测返回值的数据类型_jquery

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

在代码中,必须明确的知道返回值的数据类型才能够进行正确的计算,或者说需要一个变量的类型,下面就介绍一下如何检测返回值的数据类型,代码实例如下:

<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

从以上代码可以看出,jQuery.type()可以检测数据类型。

以上所述就是本文的全部内容了,希望大家能够喜欢。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!