下面代码运行时,标签不会在空格后读取字符串'data'.我已尝试使用optgroup元素上的一些CSS但它没有对其标签进行任何更改.
var data = "Names of Meters";
var func = function() {
var options =
"<optgroup label=" +data+ ">"
+'<option value="Meter1" >' + "Temperature" + '</option>'
+'<option value="Meter2" >' + "Wave" + '</option>'
+'<option value="Meter3" >' + "Wind Speed" + '</option>'
+ "</optgroup>";
return options
}
document.getElementById("demo").innerHTML = func();Run Code Online (Sandbox Code Playgroud)
<select type='list' name='sensors' id ="demo" multiple></select>Run Code Online (Sandbox Code Playgroud)
我有一个只使用HTML和CSS的项目.是否可以使用浏览器更改某些事件上HTML元素的内容,就像使用JavaScript".innerHTML"但只使用CSS一样.
例如使用 @media screen and(..)
即使删除当前的类名并在窗口重新调整大小上附加另一个类也是合适的.
我需要获取select标签中所有选定选项的数据,为此我使用了onclick()函数,它只提供了单击选项的数据.但是如果用户选择CTRL*A的所有选项,则不会收到任何数据.我试过使用在这种情况下不起作用的select().
//jQuery onclick()
$('select[name=sensors]').on('click', function(){
$('#demo').text($('select[name=sensors]').val());
});
//jQuery select()
$('select[name=sensors]').select(function(){
$('#demo2').text($('select[name=sensors]').val());
});Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select type='list' name='sensors' multiple>
<option value= "e11">e11</option>
<option value= "e12">e12</option>
<option value= "e13">e13</option>
<option value= "e14">e14</option>
</select>
<!--jQuery onclick()-->
<div id="demo"></div>
<!--jQuery select()-->
<div id="demo2"></div>Run Code Online (Sandbox Code Playgroud)
下面是两个包,我试图用它们将我的项目推送到heroku,控制台说npm和node已安装在服务器上,但是当我克隆项目时,项目中没有node_modules目录。package.json 中的“bower install”表示未找到 Bower。当我删除“bower install”时,推送时不会在服务器上安装任何依赖项,尽管控制台将它们记录为已安装,但当我打开浏览器控制台时,它们不会安装在服务器上。
包.json:
{
"name": "meal-order",
"version": "0.0.0",
"description": "This is an app for ordering meal",
"main": "gulpfile.js",
"dependencies": {
"angular": "^1.5.5",
.....(other angular -libs)
"express": "^4.14.0",
"gulp": "^3.8.8",
"gulp-connect": "^3.0.9",
"ionicons": "^3.0.0",
"protractor": "^3.3.0"
},
"devDependencies": {
"bower": "1.7.7"
},
"engines": {
"node": "^5.11.1",
"npm": "^3.8.6"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js",
"postinstall": "bower install"
},
Run Code Online (Sandbox Code Playgroud)
鲍尔.json:
"dependencies": {
"angular": "^1.5.5",
.....(other angular -libs)
"express": "^4.14.0",
"gulp": …Run Code Online (Sandbox Code Playgroud) javascript ×3
html ×2
bower ×1
css ×1
dependencies ×1
heroku ×1
jquery ×1
node-modules ×1
npm ×1