Solved

Jquery issue between IE and FF

Posted on 2012-03-14
2
251 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
ID: 37724989
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
ID: 37725017
Excellent! Thank you.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
show form submit button based on jquery sum 5 32
HTML5 Looping table certain Cell 11 44
HTML5 frame 5 26
Optimize simple Javascript code to use no repetitions 12 32
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

831 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