JavaScript Complex Input

Bind to the change event by type: jqxComplexInput. Author: http://jqwidgets.com

by jqwidgets

HTML

<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<input id="jqxComplexInput" type="text" />
<div id="log"></div>

JavaScript

$("#jqxComplexInput").jqxComplexInput({
    theme: "energyblue",
    width: 250,
    height: 25,
    value: "22 - 3i"
});

$("#jqxComplexInput").on("change", function (event) {
    // event arguments
    var args = event.args;
    if (args) {
        // new value
        var value = args.value;
        // old value
        var oldValue = args.oldValue;
        // real part
        var realPart = args.realPart;
        // imaginary part
        var imaginaryPart = args.imaginaryPart;
        $("#log").append("The change event has been triggered.<br />New value: " + value + "; old value: " + oldValue + "; real part: " + realPart + "; imaginary part: " + imaginaryPart + "<br />");
    }
});