“clone” file input

I had a form with plenty of inputs and one (hidden) file input. File had to be selected in modal window. So I cloned the file input in modal into the form. It worked prefectly for Firefox and Opera but not for Chrome for security reasons.

I have read plenty of similar solutions but none of them worked in Chrome.

So I found out other way – move the file input instead of cloning.
See http://jsfiddle.net/E8DBZ/2/

Advertisements

Select2 placeholder does not work (solution)

I was frustrated by select2 plugin. I did not understand why on plugin’s homepage placeholder works and on my site doesn’t. I tried to google it and i found that you must add <option></option> for your select. I tried to add multiple options with value but placeholder did not work. The first option must be empty in order to get placeholder working!
Like this:

<select id="sel" placeholder="Hello">
  <option></option>
  <option>Option value</option>
</select>

<script type="text/javascript">
  $("#sel").select2();
</script>

Here is working example: http://hromnik.com/web/select2/
Check source code for details.