Javascript value and jQuery val()
returns undefined on keyup
event. Variable currency is a select
input which I want the value of in the convertCash
function.
My code sample is below:
var currenciesData = <?php echo $this->currencies;?>;
var currency = $('#depositCurrencySelect');
var deposit = $('#depositCashEndInput');
var cashInput = $('#depositCashInput');
currency.change(function() {
convertCash(this, deposit);
});
//There is the event
cashInput.keyup(function() {
convertCash(currency, deposit);
});
var convertCash = function(element, elementToChange) {
console.log(element);
console.log('value ' + element.value);
switch(element.value) {
case 'USD':
elementToChange.val(parseFloat(cashInput.val() / currenciesData['USD'], 8).toFixed(8));
break;
case 'EUR':
elementToChange.val(parseFloat(cashInput.val() / currenciesData['EUR'], 8).toFixed(8));
break;
case 'GBP':
elementToChange.val(parseFloat(cashInput.val() / currenciesData['GBP'], 8).toFixed(8));
break;
case 'BTC':
elementToChange.val(parseFloat(cashInput.val()));
break;
}
};
Thank you!
I'm very new to ReactJS. I have some problem with the return value of async function when I call const result = this.getFieldsAPI(); the result value is [object Promise] I see [object Promise] ...
I'm very new to ReactJS. I have some problem with the return value of async function when I call const result = this.getFieldsAPI(); the result value is [object Promise] I see [object Promise] ...
There are two arrays: [ {"id": "5c5030b9a1ccb11fe8c321f4", "quantity": 1}, {"id": "344430b94t4t34rwefewfdff", "quantity": 5}, {"id": "342343343t4t34rwefewfd53", "quantity": 3} ] and [ {"id":...
There are two arrays: [ {"id": "5c5030b9a1ccb11fe8c321f4", "quantity": 1}, {"id": "344430b94t4t34rwefewfdff", "quantity": 5}, {"id": "342343343t4t34rwefewfd53", "quantity": 3} ] and [ {"id":...
I need to distinguish between Internet Explorer's builds 11.0.9600.XXXX and 11.0.10240.XXXX in my website. I tried simple JavaScript/Angular/JQuery plugins but they only give the major (11) and minor ...
I need to distinguish between Internet Explorer's builds 11.0.9600.XXXX and 11.0.10240.XXXX in my website. I tried simple JavaScript/Angular/JQuery plugins but they only give the major (11) and minor ...
I have an array like the following: data = [{'province': 'North', 'level': 1, 'count': 204}, {'province': 'South', 'level': 1, 'count': 24}, {'province': 'East', 'level': 1, 'count': 24}, ...
I have an array like the following: data = [{'province': 'North', 'level': 1, 'count': 204}, {'province': 'South', 'level': 1, 'count': 24}, {'province': 'East', 'level': 1, 'count': 24}, ...