Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Jquery issue between IE and FF

Posted on 2012-03-14
2
Medium Priority
?
257 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 35

Accepted Solution

by:
gr8gonzo earned 1200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

963 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