I have looked but have not found a specific answer for changing just one attribute. Here is an example I cooked: I only want to change the display attribute.
<html>
<head>
<title>
test
</title>
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
a.move {
height: 25px;
width: 25px;
display: inline-block;
border: 1px #aaa solid;
border-radius: 5px;
text-align: center;
text-decoration: none;
color: black;
}
a.move:hover {
background-color: #aaa;
}
---v This is the important css part
li {
display: inline-block;
width: 370px;
border: 1px #aaa solid;
}
---v This is the important css part
</style>
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var current = 1;
var wait = 0;
function next(){
current++;
update();
}
function prev(){
current--;
update();
}
---v This is the important jquery part
function update(){
$('p').text(current);
$('li').each(function(index) {
if(index != current)
$(this).css('display','none');
else
$(this).css('display','inline');
});
}
end of the important part ---^
$(function(){
update();
$('a.move.left').click(function(e){
if(wait) return;
e.preventDefault();
prev();
});
$('a.move.right').click(function(e){
if(wait) return;
e.preventDefault();
next();
});
});
</script>
</head>
<body>
<p> ... </p>
<a class="move left" href="a"><</a> <a class="move right" href="b">></a></br>
<ul>
<li>123</li><!--
--><li>123</li><!--
--><li>456</li><!--
--><li>789</li><!--
--><li>abc</li><!--
--><li>edf</li><!--
--><li>ghj</li><!--
--><li>!@#</li><!--
--><li>$%^</li><!--
--><li>ABC</li>
</ul>
</body>
</html>
Please advise. Currently, what happens is that it removes all the other css attributes. I could set all the attributes every time but I do not wish to.
Thanks