We would like to know how to style a JavaScript-generated HTML element with CSS.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.date {<!-- w ww . j av a 2 s . c o m-->
color: blue !important;
border: 3px solid red;
}
</style>
<script type='text/javascript'>
document.write('<span class="date">'+'data' + '</span>');
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: