Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

jquery toggle on sharepoint page

  Date: Oct 13    Category: MOSS    Views: 978

I injected into a sharepoint list some custom html, and one of
the elements in the html is a button. When you click on the button, it is
supposed to toggle one of the elements in that html. Now, the html gets into
the list just fine.

My problem is, that when I click on the button, it makes the entire sharepoint
page reload (I think that is a postback), and thus, I lose the effects of
clicking the button. As you can see, I added a "return false" in the
javascript, but it doesn't make any difference.

What do I do?

My html
var buttonhtml = "<tbody><tr><td colspan='100%'><button
onclick=javascript:ToggleButtonFunction("+ divElementToToggle+"; id='"+
whatbuttonID +"'>Toggle Statistics</button></td></tr></tbody>"

my javascript function:
function ToggleButtonFunction(togglewhat){
$(togglewhat).toggle(
function () { $(togglewhat).show("fast"); },
function () { $(togglewhat).hide("fast"); }
);
return false
}

Share: 

 

2 Answers Found

 
Answer #1    Answered On: Oct 13    

stupid jquery nested quoting error...

 
Answer #2    Answered On: Oct 13    


Please see your code below. I have added a "return" before the function
call (highlighted). Please check if it works.

 
Didn't find what you were looking for? Find more on jquery toggle on sharepoint page Or get search suggestion and latest updates.




Tagged: