Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在.hbs ember模板文件的占位符中添加图像_Javascript_Css_Ember.js - Fatal编程技术网

Javascript 在.hbs ember模板文件的占位符中添加图像

Javascript 在.hbs ember模板文件的占位符中添加图像,javascript,css,ember.js,Javascript,Css,Ember.js,我想在ember中将图像添加到.hbs模板文件中。我不构建应用程序,我只是尝试设计基本的待办事项列表应用程序 <section class='todoapp'> <header id='header'> <img src="../assets/logo2.png" /> {{input type='text' class='new-todo' placeholder='What else is

我想在ember中将图像添加到.hbs模板文件中。我不构建应用程序,我只是尝试设计基本的待办事项列表应用程序

<section class='todoapp'>
  <header id='header'>
    <img src="../assets/logo2.png" />
    {{input type='text'
            class='new-todo'
            placeholder='What else is in your wallet?'
            value=newTitle
            enter='createTodo'}}
  </header>

{{input type='text'
class='new-todo'
占位符=“你钱包里还有什么?”
值=新标题
输入='createTodo'}}
我的目标是在有人单击inputer字段之前,在占位符字段旁边添加一个图像。我假设我不能将其与值一起添加,那么我是否可以使用css中的.new todo类来删除图像?

使用css:

background: url('[url]') no-repeat; background-position: 10px;
调整背景像素

如果要在聚焦元素时隐藏图像,请在css中使用:focus并设置
background:none

.element-class:hover { background: none; }
此外,还可以在HTML中使用contenteditable创建一个div,在该div中,您可以从javascript中创建一个新的占位符函数(在带有contenteditable的元素中添加自己制作的占位符的函数),这样您就可以将图像添加到占位符中。

使用css:

background: url('[url]') no-repeat; background-position: 10px;
调整背景像素

如果要在聚焦元素时隐藏图像,请在css中使用:focus并设置
background:none

.element-class:hover { background: none; }

此外,还可以在HTML中使用contenteditable创建一个div,在该div中,您可以从javascript中创建一个新的占位符函数(在带有contenteditable的元素中添加自己制作的占位符的函数),这样您就可以将图像添加到占位符中。

嘿,添加图像的正确方法是在css输入中使用背景img,我做了一个测试。但是,记住,这有一个重复的问题。嘿,添加图像的正确方法是在css输入中使用背景img,我做了一个测试。但是,记住,这有一个重复的问题。