473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Is there any way to reverse preventDefaut() or return false?

I am constructing a simple FAQ page, where the page loads with all of the available questions displayed and all answers are initially hidden.

When the user clicks on a particular question, I am using javascript/JQuery to show the appropriate answer below that question. Due to differences b/n IE vs other browsers (FF, Safari), I had to use two different methods to show the answer, but I did get this to work in all cases.

The sticking point comes when I want to use an answer to be able to link to another page to supply the details of that answer. Again, the non-IE browsers work - user clicks on a question, the "answer" is shown, and they can click on the shown link to redirect to the desired page. In IE however, the shown link does not work when clicked, but if you hover over it, the cursor behaves as if it is an active link and you can see the new page path displayed on the status bar. I believe the link does not work b/c IE thinks the preventDefault or return false; conditions are still in effect, even though those conditions are no longer true. see [code] below...

Does anyone know if it is possible to "deactivate" a link in IE in order to show additional text, but then subsequently "reactivate" normal linking behavior once the hidden text has been displayed?

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     var name = navigator.appName
  3.      if (name != "Microsoft Internet Explorer") {
  4.         $(document).ready(function() {
  5.             $(".faq_answer").hide();
  6.             $("#faqs li").toggle(
  7.                 function() {
  8.                     $(this).next(".faq_answer").show();
  9.                 },
  10.                 function() {
  11.                     $(this).next(".faq_answer").hide()
  12.             }); // end toggle
  13.         }); // end ready
  14.     } else {    
  15.         $(document).ready(function() {
  16.             $(".faq_answer").hide();
  17.               $('#faqs li a').click(function(evt){
  18.                     $(this).next('p').slideToggle(1);
  19.                     return false; 
  20.               });
  21.             $("#faqs #faq_link").click(function(evt) {
  22.                 $(this).next('p a').open("http://www.nebraskaredzone.com/Banners/banners.html"); THIS CODE IS NOT WORKING
  23.             });
  24.         }); // end ready    
  25.     }; // end if
  26. </script>
  27.  
Aug 9 '10 #1
1 1609
gits
5,390 Expert Mod 4TB
i could think of a way to return false conditionally. you might set a flag (attribute) to the node and set its value to false initially. when the first action occurs the flag is false and you might return false ... then set that flag's value to true and return true when the next click occurs. that way you simply might return the flag's value.

kind regards
Aug 10 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: w i l l | last post by:
Why does this work the way it does? If someone could explain return true, and return false to me I'd greatly appreciate it. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> ...
1
by: Colin Hale | last post by:
I have a problem (amongst others)... I have the following code which sends 2 emails. I only want to send one! <A ONCLICK="OnActionClick('E-Mail')" ID="EMailNowAnchor" NAME="EMailNowAnchor"...
1
by: philjhanna | last post by:
Hi I'm having a problem applying return false to a div via addEventListener. I'm adding this so that I can drag (click-hold-move) over an image. (Its so that I can add zooming to the image)...
13
by: kurtj | last post by:
Hello Gurus: I have a validation script (below) that is somehow messed up. If the Name field is blank, I get the alert message, then the browser window goes to a blank document with the word...
8
by: Peter Afonin | last post by:
Hello, I'm using Javascript in ASP.NET application to check whether at least one checkbox in datagrid has been checked. If validation fails, the user gets a warning. If he clicks OK, the form is...
1
by: prashanth023 | last post by:
Hi, This is prashanth kumar. I am getting error , i am gettign number of records using ajax. Please solve this if n >0 i am putting return false in response function. but form is going to...
5
by: GiJeet | last post by:
Hello, I'm trying to figure this code out. <input type="submit" onclick="if(!confirm('Are you sure?') return false; "... /> I know that if you return false in an event like this onclick it...
5
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
2
Soniad
by: Soniad | last post by:
Hi, I have ASP page where there are three tabs,each showing different content. Each tab have cancel button and save button. If validation is proper; then, Save button submits the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.