我正在使用PHP从我的数据库返回数据,然后使用javascript允许此人添加它。我不能让一个div改变背景颜色和添加边框等如何使用CSS with javascript
<div class="selectedStuff"></div>
<script type="text/javascript">
$('#addButton').on('click', function(event) {
$('.selectedStuff').append($('#search_term').val() + '<br>');
});
</script>
<style type="text/css">
.selectedStuff{
background-color: yellow;
margin-top: 50px;
}
</style>
在这个问题上的任何帮助将是巨大
使用的.css()在你的divHolder – thepieterdc