Fix IE8-11 & Safari incompatibility with jquery .hide() feature on 2 form fields
- or -
Post a project like this3639
£15(approx. $19)
- Posted:
- Proposals: 5
- Remote
- #461551
- Awarded
Description
Experience Level: Entry
Estimated project duration: 1 day or less
General information for the website: We compare mortgages
Kind of development: Customization of existing website
Num. of web pages/modules: 1
Description of requirements/features: Hi all,
We have a form on our website which is having problems in IE8, 9, 10, 11 and also Safari. It works fine in Chrome and Firefox. The form is here:
https://www.choosemonkey.co.uk/form-mortgages
The field "estimated property value" is a fixed list of values. However, the "How much do you want to borrow?" field is then calculated from the "estimated property value" field. The "how much do you want to borrow" field must not display values higher than the estimated property value.
We are using this code:
//on value change in "estimated property value", hide option in "how much do you want to borrow?" question where value is greater than value in "estimated property value" question
var value = parseInt($('[name="EST_PROPERTY_VALUE"]').val());
$('[name="LOAN_AMOUNT"] > option').each(function() {
if(parseInt(this.value) > value){
$(this).hide();
}else{
var text = $(this).text().split(" (");
var percentage = 100*parseInt(this.value)/value;
percentage = parseFloat(percentage).toFixed(0);
$(this).text($(this).text()+' ('+percentage+'%)');
}
});
$('[name="EST_PROPERTY_VALUE"]').change(function(){
var value = parseInt($(this).val());
$('[name="LOAN_AMOUNT"] > option').show();
$('[name="LOAN_AMOUNT"] > option').each(function() {
if(parseInt(this.value) > value){
$(this).hide();
}else{
var text = $(this).text().split(" (");
var percentage = 100*parseInt(this.value)/value;
percentage = parseFloat(percentage).toFixed(0);
if(text.length == 1){
$(this).text($(this).text()+' ('+percentage+'%)');
}else{
$(this).text(text[0]+' ('+percentage+'%)');
}
}
$('[name="LOAN_AMOUNT"] option:visible:last').attr("selected","selected");
});
});
The problem according to stackexchange is that IE and safari do not support this $(this).hide() feature but I do not know how to fix it.
reference: http://stackoverflow.com/questions/9481563/this-hide-not-working-on-option-elements-in-ie8
http://stackoverflow.com/questions/2031740/hide-select-option-in-ie-using-jquery
http://stackoverflow.com/questions/14969959/jquery-hide-show-code-not-working-in-internet-explorer
Extra notes: I don't think this work will take very long and I need it to be completed today.
Kind of development: Customization of existing website
Num. of web pages/modules: 1
Description of requirements/features: Hi all,
We have a form on our website which is having problems in IE8, 9, 10, 11 and also Safari. It works fine in Chrome and Firefox. The form is here:
https://www.choosemonkey.co.uk/form-mortgages
The field "estimated property value" is a fixed list of values. However, the "How much do you want to borrow?" field is then calculated from the "estimated property value" field. The "how much do you want to borrow" field must not display values higher than the estimated property value.
We are using this code:
//on value change in "estimated property value", hide option in "how much do you want to borrow?" question where value is greater than value in "estimated property value" question
var value = parseInt($('[name="EST_PROPERTY_VALUE"]').val());
$('[name="LOAN_AMOUNT"] > option').each(function() {
if(parseInt(this.value) > value){
$(this).hide();
}else{
var text = $(this).text().split(" (");
var percentage = 100*parseInt(this.value)/value;
percentage = parseFloat(percentage).toFixed(0);
$(this).text($(this).text()+' ('+percentage+'%)');
}
});
$('[name="EST_PROPERTY_VALUE"]').change(function(){
var value = parseInt($(this).val());
$('[name="LOAN_AMOUNT"] > option').show();
$('[name="LOAN_AMOUNT"] > option').each(function() {
if(parseInt(this.value) > value){
$(this).hide();
}else{
var text = $(this).text().split(" (");
var percentage = 100*parseInt(this.value)/value;
percentage = parseFloat(percentage).toFixed(0);
if(text.length == 1){
$(this).text($(this).text()+' ('+percentage+'%)');
}else{
$(this).text(text[0]+' ('+percentage+'%)');
}
}
$('[name="LOAN_AMOUNT"] option:visible:last').attr("selected","selected");
});
});
The problem according to stackexchange is that IE and safari do not support this $(this).hide() feature but I do not know how to fix it.
reference: http://stackoverflow.com/questions/9481563/this-hide-not-working-on-option-elements-in-ie8
http://stackoverflow.com/questions/2031740/hide-select-option-in-ie-using-jquery
http://stackoverflow.com/questions/14969959/jquery-hide-show-code-not-working-in-internet-explorer
Extra notes: I don't think this work will take very long and I need it to be completed today.
Ryan B.
100% (13)Projects Completed
14
Freelancers worked with
11
Projects awarded
50%
Last project
8 Jun 2016
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies