I'm really sorry if this come across as stupid but i've searched everywhere but i didn't find any tip on how to go about it. i have this variable
var id = $('#sometextfield').val();
This text field value is dynamically generated eg.
<input type="text" name="id" id="id" value="<?php echo $_get[something];?>" />)
The problem here is that i have an if condition saying
if(id == 100 || id ==120) {
// i have these variables
var mulitiplier = 0.005
var price = (some alog) * mulitiplier;
// do some very long piece of code
}
else if (id == 200 || id == 220) {
// Then i have these variables
var mulitiplier = 0.090;
var price = (some alog) * mulitiplier;
// Do the same very long piece of code(its practically the same thing as
// the first if statement and the only change is the ariable multiplier)
}
This works and all but is there any way to not repeat the same thing. I don't like the look of it atm. Many thanks in advance..