Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6150063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:33:33+00:00 2026-05-23T19:33:33+00:00

I know, there are several posts with nearly the same question, but all the

  • 0

I know, there are several posts with nearly the same question, but all the mentioned “fixes” dont work for me.

but first, here is what I need:
Some forms in my application have to be enabled by activating an edit mode. If the edit mode is active every button (except save and abort) and link on the page should not do what it normaly does, but it should give a message that you have to end the edit mode instead.

My script:
The button to start the edit mode calls this:

    function startEditMode(selector) {
            var disableAction = "return false;";
            jQuery("mySelectors").each(function(){
                    jQuery(this).bind('click', editModeOnClickHandler);
                    var onClickValue = "";
                    var onClick = jQuery(this).attr("onClick");
                    if ( onClick !== undefined ) onClickValue = "" + onClick;
                    jQuery(this).attr("onClick", disableAction + onClickValue);
            });
    }

To stop edit mode a method exists which reverses all of this.
The used handler “editModeOnClickHandler” just shows the message and returns false; and is not important to my question.

So.. everything works fine in FF and IE8 (also in Chrome) but it does not in IE7. The onClick is simply not modified in IE7 via .attr as I read in other postings.

the solution which is posted everywhere:
Use event binding instead of manipulating attributes. I wish I can use that!

Here is the reason why I cant:
I tried to unbind all handlers and bind my own handler as you see in code above. But this does not prevent the inline onclick from being called.
Okay you might think, dont use inline calls.. but my project is written in JSF using Primefaces and most of its code is generated dynamically. All in all I do not have the possibility to prevent inline onclicks.

Now I am stuck.
I have to handle with inline onclicks which can only be prevented to be called by inserting a “return false;” in front, but this seems not to be possible with IE7.

Does anyone know a IE7 workaround to be able to manipulate the onclick attributes? And again: I can not use .bind(‘click’… or .click( because they are not able to stop the original inline onclick.

Thanks for all answers!
Alex

edit
with your help I figured out, that in IE7 changing the inline onclick is possibile with this.onclick = ... The correct handling of this was alreads answered in this question: How to change onClick handler dynamically?

For my concrete problem here I found no proper solution, because I was not able to manipulate the original inline onclick values without destoying them. For that reason I changed my script, so IE7 disables all buttons and links to make sure they are no longer clickable. To be sure, not to enable too much, ill add a classname too.

disabling all not yet disabled (its called in a loop):

if (!jQuery(this).attr('disabled')) {
    jQuery(this).attr('disabled', 'disabled');
    jQuery(this).addClass('editmodedisabled');
}

enable my previous disabled things:

if (jQuery(this).hasClass('editmodedisabled')) {
    jQuery(this).attr('disabled', '');
    jQuery(this).removeClass('editmodedisabled');
}

maybe this helps anyone else

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:33:34+00:00Added an answer on May 23, 2026 at 7:33 pm

    You can get the inline onclick like this: var inlineHandler = this.onclick;

    function startEditMode(selector) {
            var disableAction = "return false;";
            jQuery("mySelectors").each(function(){
                    jQuery(this).bind('click', editModeOnClickHandler);
                    var onClickValue = "";
                    var onClick = this.onclick;
                    if ( onClick !== undefined ) onClickValue = "" + onClick;
                    jQuery(this).attr("onClick", disableAction + onClickValue);
            });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are several other posts with solutions to this, but my current
I know there are already several other posts for this topic, but I've tried
I know there are several other posts on this topic but they still leave
I know there are several threads and posts regarding this issue in the internet
I know there are several threads asking similar questions - but I havent found
I know there are several questions about satellite Assembly's out there, but I still
I know there are several libraries to connect to XMPP servers, but is there
All right, do not get angry now, I know there are several questions about
I know there are several posts with a similar title. Most link to a
I know there have been several posts about random word generation based on large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.