-2

I have very very small code, where I describe behavior of button. But it don't react.

JS:

$('.boxbar').click(function(){alert('Click')});

HTML:

<div class="boxbar">
    <i class="fa fa-bars" aria-hidden="true"></i>
</div>

CSS:

.boxbar
    text-align: center
    padding-bottom: 16px
    padding-top: 12px
    height: 58px
    cursor: pointer
    [class^='box']
    color: $primary_font_color_W
    background: $primary_color_bg

    &:hover
        background: $hold_color
        color: $primary_font_color_B
kabaehr
  • 1,030
  • 11
  • 18
  • 1
    Welcome to Stack Overflow! Please take the [tour], have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Please also note that there is a **lot** of information about how to format your question on the Ask a Question page. It's well worth your time to take a moment to make your question as clear and properly-formatted as possible. – T.J. Crowder Jan 29 '17 at 17:55
  • The problem is probably this: [*Why does jQuery or a DOM method such as getElementById not find the element?*](http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element) But the question isn't clear enough to be sure. – T.J. Crowder Jan 29 '17 at 17:55
  • What is not working? – epascarello Jan 29 '17 at 17:56
  • works fine http://codepen.io/anon/pen/OWzJWY – Michael Coker Jan 29 '17 at 17:59
  • 2
    Possible duplicate of [Why does jQuery or a DOM method such as getElementById not find the element?](http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element) – Jed Fox Jan 29 '17 at 18:03

1 Answers1

-1

First off the i tag is depreceated, use em. SECOND,Your div has no text or visual element value, it takes no real estate in the browser so you'll need content in the em tag to have something to react to your alert function.