How to specify javascript to run when ModalPopupExtender is shown

How to specify javascript to run when ModalPopupExtender is shown The ASP _ NET AJAX ModalPopupExtender has OnCancelScript and OnOkScript properties, but it doesn't seem to have an OnShowScript property. I'd like to specify a javascript function to run each time the popup is shown. In past situations, I set the TargetControlID to a dummy control and provide my own control that first does some JS code and then uses the JS methods to show the popup. But in this case, I am showing the popup from both client and server side code. Anyone know of a way to do this? BTW, I needed this because I have a textbox in the modal that I want to make a TinyMCE editor. But the TinyMCE init script doesn't work on invisible textboxes, so I had to find a way to run it at the time the modal was shown. They show you how to RAISE an event manually, not not how to attach to it: asp _ net _ ajaxlibrary _ act_modalpopup.ashx ...priceless 8 Answers hmmm... I'm pretty sure that there...

Length of a JavaScript object

Length of a JavaScript object I have a JavaScript object. Is there a built-in or accepted best practice way to get the length of this object? const myObject = new Object(); myObject["firstname"] = "Gareth"; myObject["lastname"] = "Simpson"; myObject["age"] = 21; that's kinda true, but so many people are used to PHP's "associative array" that they might assume it means "ordered associative map", when JS objects are in fact unordered. In the above example, myObject.length is undefined, at least in a browser environment. That's why it isn't valid Variants of Object.{keys, values, entries}(obj).length have now been mentioned a total of 38 times in 16 answers plus in the comments of this question, and another 11 times in 7 deleted answers. I think that’s enough now. 44 Answers Updated answer Here's an update as of 2016 and widespread deployment of ES5 and beyond. For IE9+ and all other moder...