关于HTML5的一些奇技淫巧总结
设置input和textarea的required提示内容
1 | required oninvalid= "setCustomValidity('请设置内容')" oninput= "setCustomValidity('');" |
input提交按钮换成图片类型
1 | <input type= "image" src= "./foo.png" > |
设置DIV不可双击选中
1 2 | onselectstart= "return false" //添加至行内 -moz-user-select:none; //添加至CSS |
设置DIV获得focus效果
1 | tabindex= '-1' //添加属性 |
设置普通元素获得textarea编辑效果
1 | < p contenteditable = "true" ></ p > |
发布评论
还没有评论,快来抢沙发吧!