Vy Do
Vy Do

Reputation: 52716

jQuery selector by a, class, href

I have a HTML block

<a class="active" href="#mobileOrder">

I am using jQuery 2.1.1 . When I click the above block, I want call JavaScript

function move(){...}

How to do this?

Upvotes: 0

Views: 1057

Answers (1)

Roko C. Buljan
Roko C. Buljan

Reputation: 206618

Simply do like:

$("a.active[href='#mobileOrder']").on("click", move);

https://api.jquery.com/attribute-equals-selector/

Upvotes: 3

Related Questions