Question

I tried with the below code to access easyui datebox content placed inside Iframe and it doesn't succeed.

alert($("#documentFrame").contents().find("#field6").datebox('getValue');

Where #documentFrame is Iframe ID and #field6 ID if the datebox.

Getting the value of text boxes is working fine with the following code.

alert($("#documentFrame").contents().find("#field2").val());

Where #documentFrame is Iframe ID and #field2 ID if the inputbox.

How could I to get datebox value ?

Was it helpful?

Solution

To accomplish the process of getting datebox content which is placed inside Iframe you can follow this:

You need to write function as below in your iframe document which returns datebox value.

Code

function getValue(value){
    var id='#'+value;
    var val= $(id).datebox('getValue');
    return val;
}

From parent document you can call getValue() method and pass datebox component ID as argument to the getValue() method.

Code to call getValue() from Iframe parent document

value = window.frames[0].getValue('field ID');
alert(value);

Thank you

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top