markdown guide


if ($element.filter('.js-cool, .js-beans')) {


if ($element.filter('.js-cool, .js-beans').length) {

.filter returns an Array, which inherits from Object, and all Objects are truthy in JavaScript.


We can use a check to see what values the input has at keyboard events. Then if it has empty string we can simply restore the original font-size of the mentioned classes.

Here is an approach to do so:

$(function() {
  $(".checker").on("keydown keyup", function(ev) {
    $(".js-cool, .js-beans").css("font-size", "24px");
    $input_val = $(this).val();
    if ($input_val == "") {
      $(".js-cool, .js-beans").css("font-size", "inherit");

Why looping over all objects and filter out then when you can start with a beter filter.

$('.js-cool, .js-beans').each(function() {
    $(this).css("font-size", "24px");
Classic DEV Post from Jun 15 '19

What are your favourite resources for beginners?

What resources would you give a new team member who is also starting their first tech job?

John Costanzo profile image
An EmberJs Developer who loves to build web apps

👋 Hey dev.to reader.

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️