. I landed on what for my purposes is a nice alternative. Copyright The objective is to accept a calculated value unless the user enters a different value in the calculated field. For example, the above event handler function clickHandler To determine the event's target element, your JavaScript event handler functions can use the following event properties: event.srcElement in Internet Explorer; event.target in most other browsers. For example, a mouse event includes different information than an input box editing event. This property is very useful in event delegation, when events bubble. Question: How do I determine the event's target element? This property is very useful in event delegation, when events bubble. is registered and invoked for the document element, To determine the event's target element, your JavaScript event handler functions can use the following event properties: Example: All standard DOM event objects have a target property, a reference to the element that raised the event. How do I prevent the browser's default action in a JavaScript event handler. Event target element may be the same element that invoked the event handler.

, , etc. The reason for this is that the calculated value will more often than not be the value desired, but not always.I have accomplished this using this approach:var estimate = +this.getField("num.SS.TitleCostEst").value;if(event.value != "")event.value = event.valueelseevent.value = estimateThis works but not ideally. These forums are now Read Only. So, for example, this code will apply to a field the value of another field, times 2, but will also allow the user to enter their own value instead. google_ad_slot = "7989268040"; If it is we move to its parent node, the HTML element. Syntax: event.target Parameter: It does not accept any parameter because it is a property not a function. to display the HTML tag name of the target element in an alert box: Demo: click anywhere on this page to see this event handler in action! I am looking for a better way to cause an entered value to override a calculated value. The target property can be the element that registered for the event or a descendant of it. It will help to restate the oringinal scenario. (e.g. What is an Event? Getting input value. element defining the image. event.target – is the “target” element that initiated the event, it doesn’t change through the bubbling process. © 1999-2011, JavaScripter.net. When the user clicks a button, that a click, too, is an event. I'll call this value the "target" value, which is either the estimate or the final value, if the latter is entered. I am looking for a better way to cause an entered value to override a calculated value. click, mousedown, mouseup, mousemove) Web hosting by Digital Ocean | CDN by StackPath, "https://code.jquery.com/jquery-3.5.0.js". For example, have target elements; so do keyboard events When you release a key while typing in a multiline text area, The most deeply nested element that caused the event is called a target element, accessible as event.target.. /* 728x90_20101016 */ The field with the calculated value is an estimated figure derived from a known rate times a known price. More often than not this estimate is the final figure needed, but occasionally the actual cost varies from the estimate, and the latter situation is what creates a need to make a user-entered "final" value override a calculated value (the estimate). google_ad_width = 728; Description: The DOM element that initiated the event. It relates to the order in which event handlers are called when one element is … which is an ancestor of all specific event target elements such as keydown, keypress, or keyup). the keyup event's target is the