Solved

Jquery issue between IE and FF

Posted on 2012-03-14
2
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

617 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