Hi,

I have the following question, if any of you could please explain to me.

I have seen html form elements such as this :

<input type="button" onChange = "return randomFunction(arg x, arg y, arg z)" />

Can somebody explain what this is and how it is different to this :

<input type="button" onChange = "randomFunction(arg x, arg y, arg z)" />

Thank you!

In the second version, without return, the function is called, and noting else. In the first version, with return, the return value of the function is returned. If that return value is false, the default action is cancelled. I don't think you can cancel onchange, but if you return false onsubmit, for example, a form is not submitted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.