Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts

    Unable to remove and/or unbind inline JS events

    ok I am trying to remove some default inline javascript ( dont have access to serverside to remove the code that generates it)

    but it's not workign for some odd reason


    I am developing in sharepoint 2007. I am trying to remove the click events for certain links, and it will not work.
    Ive tried .removeAttr, removeProp , unbind and combinations thereforth of

    example html:

    Code:
    <th nowrap="" onclick="javascript:MoveToViewDate('2\u002f28\u002f2012','Day');" onmouseout="this.className = 'ms-cal-wtopdayfocus';" onmouseover="this.className = 'ms-cal-wtopdayfocusover';" class="ms-cal-wtopdayfocus" colspan="4" scope="col">
    <div><img width="1" height="1" alt="" src="/_layouts/images/blank.gif"><br><a tabindex="4" href="javascript:MoveToViewDate('2\u002f28\u002f2012','Day');">28&nbsp;<span>Tuesday</span></a>
    </div>
    </th>
    lastest attempt: ( this is going in a dom ready section - verified Im targeting the correct elements by adding coloring via .css())
    Code:
    $("th.ms-cal-wtopday div a,th.ms-cal-wtopday-today div a,th.ms-cal-wtopdayl div a").removeProp("mouseover mouseout").unbind("mouseover mouseout")
    the API says to use .removeAttr, but it's not working.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,592
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Try setting the properties to null instead.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Oh sorry, tried that too using .prop("onmouseover",null)

    this one is driving me crazy, becuase even when watching in firebug, you can see it's affecting the proper selectors, so im not sure whats going on


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •