Reputation: 570
I'm using PHP to return data from my database and then using javascript to allow the person to add it. And I can't make a div change its background color and add borders etc.
<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>
Any help on this matter would be great
Upvotes: 0
Views: 53
Reputation: 2244
$('#addButton').on('click', function( event ) {
var searchedValue = $('#search_term').val();
var divHolder = $('.selectedStuff');
divHolder.append(searchedValue + '<br>').css({
'background-color': 'yellow',
'margin-top': '50px'
});
});
Upvotes: 2