Category: JavaScript

How to select the active links using jQuery

There are numerous ways in which one can add active class to a link. One way is to use if statements to do so. Modern JS frameworks such as Angular, React and VueJS support route-link  designed to manage routes in the application. The same effect can also be achieved with jQuery. It is certainly a

Continue Reading

One way object binding in JS

This is something I've been putting together this weekend. Due to the fact, that ASP.NET is quite reluctant to get an array of results from a request, I've devised an alternative way of sending data to the server via Web.API. There are already several large frameworks that handle data-binding like Knockout and AngularJS, but these

Continue Reading

Overriding onClick event in jQuery

Interesting problem today, I tried to override behaviour of an image. The simple approach of replacing behaviour obviously didn't work:

Neither $("#game-image").removeAttr('onclick'); did anything. There is a function unbind.

This can be followed by the 'overriding' function:

Continue Reading

Using ng-class with Select

Today, I wanted to bind value from a select to a span. Depending on the value selected the colour of the label was supposed to be different. Using AngularJS, I introduced ng-class="". It allows you to change classes conditionally. This is an example:

Continue Reading

Opening Binary File from the Server using jQuery

Reading binary files in jQuery isn't particulary hard. There are two things really that we have to do. The first one is change the dataType to binary and the second one is setting the processsData to false.

Continue Reading