How to get the mendix page input value into the java script snippet

Hi  I am unable to get the values entered in the input text field in mendix page into java script snippet . I also want the the selected boolean value in mendix page into the java script  I am using the JavaScript Snippet Please find the below screen shots          The java script i have written in this is as below    $('.cityName').change(function(){ alert('hi '); alert('class names ------ '+this.className); alert('entered value '+$(this).val());   });   I am getting class name as form-group mx-name-textBox4 cityName in alert box and i am not getting any entered value .    i also tried $(‘.myclassName’).val(); document.getElementsByClassName("example")[0]  but the O/P is not coming    Thanks 
2 answers

Lose the () after the .val function because .val() will set the value. Without the braces it will get the value.



Hi ,

I didn’t get the O/P when i used val without braces .

Please find the screen show for reference .


Below is the Script i used 



alert('hi ');

alert('class names ------ '+this.className);

alert('entered value '+$(this).val);




O/p :- hi

class names ------ form-group mx-name-textBox4 cityName

I got O/P as below for val 

function (value) {
var hooks, ret, elem = this[0];
if (!arguments.length) {
    if (elem) {
        hooks = jQuery.valHooks[elem.nodeName.toLowerCase()] ||
        if (hooks &&
            "get" in hooks &&
            (ret = hooks.get(elem, "value")) !== undefined) {
            return ret;
        ret = elem.value;
        return typeof ret === "string" ? ret.replace(rreturn, "") : ret == null ? "" : ret;
    return undefined;
var isFunction = jQuery.isFunction(value);
return this.each(function (i) {var self = jQuery(this), val;if (this.nodeType !== 1) {return;}if (isFunction) {val =, i, self.val());} else {val = value;}if (val == null) {val = "";} else if (typeof val === "number") {val += "";} else if (jQuery.isArray(val)) {val =, function (value) {return value == null ? "" : value + "";});}hooks = jQuery.valHooks[this.nodeName.toLowerCase()] || jQuery.valHooks[this.type];if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {this.value = val;}});}