.getValue(container?)
Available on: InDom

Returns the current value of the element, normalized for its type.
Single value inputs ( input, textarea, etc.): string or null.
select (single): string or null.
select (multiple): array of selected values or empty array.
input[type=checkbox] (same name group): array of checked values.
input[type=radio] (same name group): string of the checked value or null.
input[type=file] (single or multiple): FileList object (zero or more files).

Parameters:
container {Document | Element | InDom} (optional) - Scope for checkbox and radio group lookups. When provided, only searches within this container for related elements. Defaults to document.

Returns: {string | string[] | FileList | null} - string for single values, array for multiple/select, FileList for file inputs, null when no selection or the element lacks a value property

Throws:
Error - If the underlying element has been removed

Examples:
<div class="input-examples">
	<div><input type="text" name="username" value=""></div>
</div>
<div class="input-examples">
	<div><input type="text" name="username" value="">div>
	<div><textarea name="message">textarea>div>
	<div>
		<select name="color">
			<option value="red">Redoption>
			<option value="green" selected>Greenoption>
			<option value="blue">Blueoption>
		select>
	div>
	<div>	
		<select name="size" multiple>
			<option value="s">Smalloption>
			<option value="m">Mediumoption>
			<option value="l">Largeoption>
		select>
	div>
	<div>
		<input type="radio" name="payment" value="credit" id="credit">
		<label for="credit">Credit Cardlabel>
		<input type="radio" name="payment" value="debit" id="debit">
		<label for="debit">Debit Cardlabel>
		<input type="radio" name="payment" value="paypal" id="paypal">
		<label for="paypal">PayPallabel>
	div>
	<div>
		<input type="checkbox" name="features" value="wifi" id="wifi">
		<label for="wifi">WiFilabel>
		<input type="checkbox" name="features" value="bluetooth" id="bluetooth">
		<label for="bluetooth">Bluetoothlabel>		
		<input type="checkbox" name="features" value="gps" id="gps">
		<label for="gps">GPSlabel>		
	div>
	<div>
		<input type="file" name="documents" multiple accept=".pdf,.doc,.docx">
	div>
div>

const container = $1('.input-examples');

// Iterate through each direct div child of the container.
$a('>div', container).each(div => {
    // Find the first child element within the current div.
    // Based on the HTML structure, this is the actual field input/textarea/select/etc.
    const field = $1('>*', div);

    // Create a button 
    const btn = $n("log value");

    // Append the button to the current div so it sits next to the field.
    div.append(btn);

    // Attach a click event listener to the button.
    btn.onClick(() => {
        // When the button is clicked, log the field's name and its current value.
        console.log(`name: ${field.getAttr("name")} value:`);

        // Call the getValue() method on the field and log the result.
        // The output will vary based on the type of field and its current state.
        console.log(field.getValue());		
    });
    /*
    Expected outputs based on initial HTML state:
    - input "username" -> string 
    - textarea "message" -> string
    - select "color" -> string (selected color)
    - select "size" multiple -> array of strings (selected sizes), empty if none selected
    - radio "payment" -> string (selected payment), null if none selected
    - checkbox "features" -> array of strings (selected features), empty if none selected
    - file "documents" -> FileList object, empty if none selected with .length 0
    */
});
Modern DOM Power
for TypeScript, ESM & Plain JS
3.8KB JavaScript library that simplifies DOM manipulation
with a clean, chainable API for events, data, inputs harvesting, and more.
Automatic Cleanup,
Leak-Proof by Design
Events and state are cleared when elements leave the DOM,
even if removal happens outside InDom.
Cleaner Code,
Better Ergonomics
Get the InDom object directly in callbacks.
One element, one instance.
Works With Your Existing Stack
Use InDom on its own or alongside any library or framework,
its architecture ensures a seamless integration.