【问题标题】:showing something using jquery while typing?在键入时使用 jquery 显示一些东西?
【发布时间】:2011-05-09 21:24:17
【问题描述】:

我想只在用户开始在文本字段中输入时显示图像。

$('#type').keyup(function(){
//show the images
    });

html

<input type="text" name="type" id="type">

<div id="showimage"></div>

图片

showimage.jpg

【问题讨论】:

  • 你试过$('#showimage').show();吗?
  • @gateway 您是否从 ajax 调用中获取图像详细信息??

标签: jquery html css image input


【解决方案1】:

jquery:

$('#type').keyup(function(){
   $('#image').show();
});

html:

<img id="image" src="showimage.jpg" style="display: none"/>

【讨论】:

  • 如果我想在删除表单中的所有文本时关闭图像,该怎么做?非常感谢。
  • @LuckyLuke 您可以使用hide 进行隐藏。有关类似示例,另请参阅 this SOq
猜你喜欢
  • 2011-12-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-18
  • 1970-01-01
  • 2013-07-18
  • 2011-05-07
  • 1970-01-01
相关资源
最近更新 更多