Sarang Amrutkar
Sarang Amrutkar

Reputation: 883

changing text in attribute value of jquery dynamically

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 ?

Upvotes: 0

Views: 82

Answers (1)

jfriend00
jfriend00

Reputation: 708206

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'); 
};

Upvotes: 3

Related Questions