// Helper func
init = (obj, id) => {
return obj.style.split(':')[id]
}
train = (i, o) => {
iProp = init(i, 0);
iVal = init(i, 1);
oProp = init(o, 0);
oVal = init(o, 1);
alert($(i.dom).css('color'))
}
train({
dom: 'p',
style: 'color:rgb(0, 0, 0)'
}, {
dom: 'p',
style: 'color:rgb(0, 50, 65)'
})
p {
color: black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>Text</p>
When I run the code it gives an empty alert, in anWriter Editor it gives an alert 'Undefined'. Why jQuery doesn't see CSS, but I added CSS at the top of the HTML page. Why does it output undefined and how to fix it?


rgb(0, 0, 0), this is using Chrome.