JavaScript Complex Input

Invoke the getReal method of the 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>
    <input style="margin-top: 20px;" type="button" id="jqxButton" value="Get the real part" />
</div>

JavaScript

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

$("#jqxButton").jqxButton({
    theme: "energyblue",
    height: "30px",
    width: "120px"
});

$("#jqxButton").on("click", function () {
    var realPart = $("#jqxComplexInput").jqxComplexInput("getReal");
    alert("The real part is: " + realPart);
});