I have codes below,
<div id="uploadBox" class="well" onClick="$('#photoimg').click();">
<button class="btn btn-mini btn-primary" type="button">Upload File</button>
<input type="file" class="hide" name="photoimg" id="photoimg" onchange="$(this.form).submit();"/>
Just wondering what these codes mean,
Okay let me guess, when I click the button, it will invoke the <input type="file" ...> and auto submit the form with the codes,
Am I right or am I wrong?
Thanks in advanced.
You are right.
is shorthand for:
which will execute all handlers and behaviours attached to the matched element.
I'm not sure why you would want to do this, though.
First off, in-line event handlers are usually a bad thing, as they impact negatively on the readability and maintenance of your mark-up.
Secondly, wouldn't it be less confusing to have a "Select File" button and a "Submit" button?
Hope that helps.
Ah, ok. With a bit more context it makes more sense.
I still stand by what I said about in-line event handlers, though.
This topic is now closed. New replies are no longer allowed.