Solved

Jquery issue between IE and FF

Posted on 2012-03-14
2
248 Views
Last Modified: 2012-06-27
I have a checkbox that enables/disables a select menu and textarea which works fine but
I need this code to retain settings if a "Back" button is clicked on the POST page. FF retains the enabled settings but IE disables the form elements again which causes the input to be lost even though the checkbox is still checked. How do I make IE see that the form elements should still be enabled in jquery?

<script> 
<!--
$(document).ready(function () { 
 $("#add_room").click(function () {  
 $("#room_type_additional").attr("disabled",!this.checked) 
   $("#room_type_additional").focus()
   $("#s_requests_add").attr("disabled",!this.checked) 
});});
--> 
 </script>

Open in new window

0
Comment
Question by:jriver12
2 Comments
 
LVL 34

Accepted Solution

by:
gr8gonzo earned 300 total points
Comment Utility
Try this:

<script>
<!--
$(document).ready(function () {

 $("#add_room").click(function () {  
    addRoomEvent(this.checked, true);
 });

 addRoomEvent( $("#add_room").is(':checked'), false );

});

function addRoomEvent(isChecked, setFocus)
{
   $("#room_type_additional").attr("disabled",!isChecked) ;
   if(setFocus)
   {
     $("#room_type_additional").focus();
   }
   $("#s_requests_add").attr("disabled",!isChecked) ;
}
-->
</script>
0
 

Author Closing Comment

by:jriver12
Comment Utility
Excellent! Thank you.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Angular JS question 24 37
Condidional <a href = ....> 1 22
Run command in each subfolder using batch file 7 21
Jquery autocomplete 10 17
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now