jQuery 的官方网站是啥?
http://jquery.com/jquery插件哪个网站好
两个插件库网站很好保证你喜欢:1. jquery插件库 我一直在用http://www.jq22.com/
2. jquery之家 http://www.htmleaf.com/
jquery
没明白你要设置什么默认值,有如下几种:
1、什么都不做,默认显示第一个option
2、$(selector).val(默认值):注意要在option中此值,要不然还是选择第一个option
jquery
name是input标签的属性值,jQuery提供了attr() 方法用于设置/改变属性值
$("input:text").attr("name");
$("input:text").prop("name"); // 也可以使用prop()方法获取属性
示例代码如下
创建Html元素
点击按钮获取文本框的name属性值:
设置css样式
***.box{width:300px;height:250px;padding:10px 20px;margin:20px;border:4px dashed #ccc;}
***.box>span{color:#999;font-style:italic;}
div.content{width:250px;height:100px;margin:10px 0;padding:5px 20px;border:2px solid #ff6666;}
input[type='text']{width:200px;height:30px;border:none;}
input[type='button']{width:120px;height:30px;margin:10px;border:2px solid #ebbcbe;}
编写jquery代码
$(function(){
$("input:button").click(function() {
alert($("input:text").attr("name"));
});
})