3 ms·
$('#business-class').toglleClass('selected', this.value === 'business'); And $('#business-class') should be in a var.
by rimliu 9y ago
$('#business-class').toglleClass('selected', this.value === 'business');
And $('#business-class') should be in a var.
- rtpg 9y agothis is indeed a cleaner example. I think if you are diligent about your layout, you can separate out your DOM operations from your logic operations (think Flux) and end up with nice and simple code like this. Personally I like the "rails" given to me in Angular/React (especially given I know how to circumvent them). I also am more productive in them. But I bet a lot of skilled programmers can go far with just simple tools like jQuery. At least for me, having a paradigm enforced is useful, especially on larger projects with multiple stakeholders.