Javascript only firing once

KateTheGreat

long-time lurker here asking my first public questions because I am truly stuck.

I'm working on a hosted shopping cart platform so I only have access to add code in certain designated divs. I have a javascript code that I'm calling externally (because inline is bad unless you have to, right?)

So my issue is, There is a <select> dropdown that I do NOT have direct access to change HTML and the silly shopping cart platform didn't give it an id, only the name attribute is set.

I need to clear the <div id="result_div"> when the <select name="ShippingSpeedChoice"> drop-down is clicked so I have:

$("[name=ShippingSpeedChoice]").change(function(e) { $("#result_div").empty(); });

It fires once, but that's it. My question is, how do I make it fire EVERY TIME the <select name="ShippingSpeedChoice"> is clicked?

Here's all the relevant javascript (in case it's preventing #result_div from clearing somewhere):

    $("[name=ShippingSpeedChoice]").change(function(e) {
        $("#result_div").empty();
    });

    $("#btn_calc").click(function(e) {      /// onclick on Calculate Delivery Date button

Thanks in advance, any help is appreciated!

KateTheGreat

I still wasn't able to use the name attribute to call the function, so I found a way around it by using the id of the td the ShippingSpeedChoice dropdown was in:

    $("#DisplayShippingSpeedChoicesTD").change(function(e) {
        $("#result_div").empty();

And it fires every time now. Thank you so much for all your feedback & assistance - I still wish I could figure out how to use the name attribute rather than the id, but that will be a puzzle for another day!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Javascript only firing once

From Dev

Javascript recursion only firing once

From Dev

First half of 'if statement' in javascript is only firing once

From Dev

addEventListener only firing once

From Dev

Promise is only firing once?

From Dev

ScheduledExecutorService Is Only Firing Once

From Dev

KeyUpHandler firing only once

From Dev

Coroutine only firing once

From Dev

Javascript key down only firing once when key is held down

From Dev

onkeyup function only firing once

From Dev

NeedDataSource and ItemDataBinding are firing only once

From Dev

Drag Events Only firing once

From Dev

Java swing mousemove firing only once

From Dev

Change event handler firing only once, jQuery

From Dev

Drools Rule format for firing only once

From Dev

Proximity alert firing alert only once

From Dev

didUpdateLocations called only once and then stops firing

From Dev

jquery newbie: callback firing only once

From Dev

Change event handler firing only once, jQuery

From Dev

jQuery UI effect .on click only firing once

From Dev

video.js loadedalldata firing only once?

From Dev

On click event only firing once JQuery / bPopup

From Dev

Javascript firing event more than once

From Dev

javascript reload only once

From Dev

Android RX - Observable.timer only firing once

From Dev

iOS Safari Mobile doesn't trigger pageshow firing only once

From Dev

Why is my bubble sort not sorting duplicates and only firing once?

From Dev

setTimeout keeps firing, how to make it fire only once?

From Dev

Backbone View event firing only once after view is rendered