简体   繁体   中英

Using dijit.byId to get dijit.form.DateTextBox value

Inside the alert(Invalid Date) is coming, please tell me how can get the date value

<html>
  <head>


   <link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"/>

 <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
 </script>

    <script>

            dojo.require("dijit.form.DateTextBox");


    </script>


<script>

function callMe()
{
var val = dijit.byId('fromDate_out').value;

alert(val);
}

</script>



  </head>
  <body class="claro">

<div dojoType="dijit.form.DateTextBox" require="true"   id="fromDate_out"   placeHolder="From Date" onChange="dijit.byId('fromDate').constraints.max =arguments[0];" ></div>

    <input type="button" onclick="callMe()"/>

</body>
</html>

The proper way to get properties from dijits is to use get . Try changing callMe to the following:

function callMe()
{
    var val = dijit.byId('fromDate_out').get("value");
    alert(val);
}

Yes according to new API's the proper way is

dijit.byId("id").get('value');

Older ways are also there but deprecated still can work

dijit.byId("id").getValue();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM