$(document).ready(function(){
$("[type=range]").change(function(){
if(!$('#changetoyello').hasClass('yellow'))
$('#changetoyello').addClass('yellow');
});
});
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>
<body>
<li>
Apply Credits1:
<input type="range" min="0" max="100"
name="discount_credits1" id="discount_credits"
/>
</li>
<li>
Apply Credits2:
<input type="range" min="0" max="100"
name="discount_credits2" id="discount_credits"
/>
</li>
<a href="javascript:void(0)" id="changetoyello" onclick="resetfilter()" class="btn btn-info" role="button">Link Button</a>
</body>
</html>
这是我的代码:每当我更改任何滑块时,都会添加两个范围滑块,因此我的按钮颜色应变为黄色 问题是我只想将按钮颜色更改为 每当我更改范围时都会变成黄色
答案 0 :(得分:2)
这可以通过引入以下CSS来实现:
getInstalledRelatedApps()
以下是一个有效的代码段,展示了实际的解决方案:
from pandas.io.json import json_normalize
data = [
{
"first_name": "Robert",
"last_name": "Bradford",
"Children": [
"Jack",
"Lindsey"
],
"details": {
"age": "42",
"city": "New York",
"state": "NY"
}
},
{
"first_name": "Simon",
"last_name": "Warters",
"Children": [
"Megan"
],
"details": {
"age": "35",
"city": "Buffalo",
"pin": "14220",
"secured": "yes",
"citizen": "yes"
}
}
]
train = json_normalize(data)
print(train)
.btn.yellow {
background:yellow;
border-color:yellow;
color:black; /* Make text readable on yellow background */
}
$(document).ready(function() {
$("[type=range]").change(function() {
if (!$('#changetoyello').hasClass('yellow'))
$('#changetoyello').addClass('yellow');
});
});
/* Remove yellow theme when clicked */
$('#changetoyello').click(function() {
$(this).removeClass('yellow');
});
要在单击时从按钮中消除黄色,请将以下内容添加到脚本中:
.btn.yellow {
background:yellow;
border-color:yellow;
color:black;
}