Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQWidgets jqxComplexInput val() Method

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful and optimized framework, platform-independent, and widely supported. The jqxComplexInput is a jQuery input widget that is used for taking input of complex numbers containing real and imaginary part.

The val() method is used to set or return the value of the widget. It accepts Single parameter value of String/Object type value and returns the String type value.

Syntax:

Set the value of widget.

$('Selector').jqxComplexInput('val', complex_value);  // or
$('Selector').val(complex_value);

 

Return the value of widget.

var value = $('Selector').jqxComplexInput('val'); // or
var value = $('Selector').val();

Linked Files: Download jQWidgets from the given link https://www.jqwidgets.com/download/. In the HTML file, locate the script files in the downloaded folder.

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqx-all.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcomplexinput.js”></script>

The below example illustrates the jQWidgets jqxComplexInput val() Method.

Example:

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
        "jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" 
        src="scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqx-all.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" 
        src="jqwidgets/jqxcomplexinput.js"></script>
</head>
  
<body>
    <center>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
  
        <h3>
            jQWidgets jqxComplexInput val() Method
        </h3>
  
        <div id="jqxCI">
            <input type="text" />
            <div></div>
        </div>
        <br>
  
        <input type="button" id="jqxBtn" 
            value="Set the Value" 
            style="padding: 5px 15px;">
    </center>
  
    <script type="text/javascript">
        $(document).ready(function() {
            $("#jqxCI").jqxComplexInput({
                width: 300,
                height: 40,
                value: "1500 + 722i",
                spinButtons: true
            });
  
            $("#jqxBtn").on("click", function () {
                $("#jqxCI").jqxComplexInput('val', '100 - 60i');
            });
        });
    </script>
</body>
  
</html>

Output:

Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcomplexinput/jquery-complex-input-api.htm


My Personal Notes arrow_drop_up
Last Updated : 29 Sep, 2021
Like Article
Save Article
Similar Reads
Related Tutorials