0

I have the following jQuery code:

var fnVal = $(_placeHolder[0].parentElement.children[0]).attr('onclick');

While debugging I can see the value of fnVal as

function onclick(event) { 
    javascript:DisplayData($('#divexpand')[0],'true'); 
}

I wish to replace true in DisplayData function to false.

How can I achieve that ?

1
  • I assume you're looking for something programmatic, rather than simply changing the onclick attribute of the element? Commented Oct 18, 2012 at 7:40

1 Answer 1

3

Just assign it a new function which will replace the old one (also no need for jQuery in this):

_placeHolder[0].parentElement.children[0]).onclick = function() {
    DisplayData(document.getElementById('divexpand'),'false'); 
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.