jQuery :image选择器
:image选择器语法
$(“:image”)
:image选择器语法解析
jQuery中的:image选择器可以选择所有"type=image"的HTML元素,比如input等。
:image选择器实例代码
如下实例代码,通过:image选择器选择HTML的元素,比较type属性值不同的情况下被匹配选择的效果,同时比较img元素是否会被匹配选择(运行结果显示,img并不会被:image选择器匹配选择):
<input type="text"><br>
<input type="image" src="../../static/img/test.jpg" style="width:30%;height:30%"><br><br>
<img src="../../static/img/test.jpg" style="width:30%;height:30%"><br><br>
<button id="test" type="button">确定</button>
<script>
$("#test").click(function(){
$(":image").css("width","100%")
})
</script>
免责声明:内容仅供参考,不保证正确性!