Reputation: 3777
I am currently using an input value in a form to dynamically kick off a function to search an array for zip codes and display like this and it works great:
$('input[name=zip]').keyup(function() {
I'd like to make the button element be used instead so that when you keydown it performs the same function.
The "button" is a HREF element like this:
<a class="lp-element lp-pom-button" id="lp-pom-button-27" href="#"><span class="label">Calculate Quote</span></a>
I tried to alter the input element like this to use an a
and also a href
and switched the name=
to a id=
to no avail. Is it possible to do this?
$('a[id=lp-pom-button-27]').keyup(function() {
Upvotes: 0
Views: 81
Reputation: 167182
Are you trying to use mouseup
instead?
$('a[id=lp-pom-button-27]').mouseup(function () {
The element <a>
can receive only mouse events and not keyboard events.
Upvotes: 1
Reputation: 785
Try :
$('a[id=lp-pom-button-27]').click(function() {
I do not see how you can keyup
on a button, click
event seems a better option for me.
Upvotes: 1