select html5验证必须选择,仅在未选择任何内容时选择默认文本[HTML5](Select default text visible only when nothing is selected...

仅在未选择任何内容时选择默认文本[HTML5](Select default text visible only when nothing is selected [HTML5])

我觉得这个问题很简单,但我不知道。 你知道HTML5中的那些文本框,例如密码框,它会显示“写密码”,但是当你点击它时,文字会消失吗? 怎么叫? 可以在HTML5中选择对象吗?

谢谢

- - - - -编辑 - - - - - -

我在这里找到答案,如果有人对这个问题感到困惑: 我如何为'选择'框制作占位符?

I think this question is very easy, but I don't know it. Do you know those text boxes in HTML5, for example password box, and it says "Write Password", but when you click on it, text disappears? How is that called? Can it be done to select object in HTML5?

Thank you

---------EDIT-----------

I found answer right here, if someone bumps on this question: How do I make a placeholder for a 'select' box?

原文:https://stackoverflow.com/questions/28308825

更新时间:2019-12-17 16:40

最满意答案

在文本框中使用placeholder属性:

对于选择框,请看一下这个问题:

Use placeholder attribute on your text boxes:

For select box take a look at this question:

相关问答

这是不可能的,因为这会带来安全风险。 人们对其文件夹结构使用相当真实的信息,并且访问文件夹名称本身就构成了直接风险。 如下所述: 使用javascript获取浏览器下载路径 大多数操作系统倾向于默认为下载位置,这是用户通过他们使用的浏览器决定的。 不是网站。 Its not possible because this poses a security risk. People use fairly real information for their folder structure and ac

...

您应该在加载时触发事件。 $(document).ready(function(){

$('#szab').change(function(){

if($('#szab option:selected').text() == "Last"){

$('#Last').css("visibility","visible").css("height","auto");

}else{

$('#Last').css("visibi

...

问题是因为您的属性以选择器开头无效。 您需要将值包装在引号中,因为-将无法正确解释。 尝试这个: jQuery(function($) {

$('[id^="select-additional-number-country-"]').change(function() {

var id = this.id.split('-').pop();

$("#select-additional-number-state-" + id).val('').find("option").

...

使用Selection API(IE <= 8除外,它不支持它): dropHandler = function(e) {

text = e.dataTransfer.getData('text');

if (document.caretRangeFromPoint)

{

range = document.caretRangeFromPoint(e.clientX, e.clientY);

}

else if (document.createRange && oe.r

...

在文本框中使用placeholder属性:

http://www.w3schools.com/tags/att_input_placeholder.asp 对于选择框,请看一下这个问题: 如何为“选择”框制作占位符? Use placeholder attribute on your text boxes:

...

Untitled Document

...

var video = document.getElementById("video"); // assuming "video" is your videos' id

video.removeAttribute("controls");

例如: http : //jsfiddle.net/dySyv/1/ var video = document.getElementById("video"); // assuming "video" is your videos' id

video.remo

...

使用padding-right CSS属性

Using padding-right CSS property

我同意Joshua的观点,颜色来自系统,但我不同意CSS,例如CSS-Tricks : ::selection { background: #ffcc89; color: #222; }

::-moz-selection { background: #ffcc89; color: #222; }

有关详细信息,请参阅选择样式上的Quirksmode 。 I'd agree with Joshua that the colors come from the system, but I'd disa

...

你确定你甚至理解你的代码吗? 这看起来像是从某处复制/粘贴它。 有一个匿名函数太多,并且在更改不应该构建对话框。 此事件应该打开对话框: $(document).ready(function() {

$("#division").change(function() {

$("#dialog").dialog("open");

});

$("#dialog").dialog({

maxWidth: 800,

maxHeigh

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值