jquery file是什么意思


本文摘自PHP中文网,作者coldplay.xixi,侵删。

file的意思为“文件”,是jquery中的一个选择器,可以选取带有【type=file】属性的input元素,语法为【$(":file")】。

相关推荐:《jQuery视频教程》

定义和用法

:file 选择器选取带有 type=file 的 input 元素。

语法

1

$(":file")

实例

选取带有 type="file" 的 <input> 元素:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">

</script>

<script>

$(document).ready(function(){

  $(":file").css("background-color","red");

});

</script>

</head>

<body>

 

<form action="">

用户名: <input type="text" name="user"><br>

文件: <input type="file" name="myfile">

</form>

 

</body>

</html>

更多编程相关知识,请访问:编程学习!!

以上就是jquery file是什么意思的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

jQuery $(this)怎么用

jQuery判断是否存在class的方法

jQuery怎么添加css

jQuery $(document).ready()和onload的区别是什么

jQuery的ajax返回值为中文乱码怎么办

jQuery 判断元素是否可见的实现方法

jq怎么设置css样式

jQuery怎么判断字符串是否包含子串

jQuery中$("#")与$("#"+xx)的差异

jQuery如何判断元素中是否存在标签

更多相关阅读请进入《jQuery》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...