Styling AttachmentEditor "Choose File" Button

1331
2
10-12-2017 07:32 AM
KeithGerhartz1
Occasional Contributor II

Is it possible to style the Choose File button in the JSAPI attachmenteditor? I want to make it look consistent with the other dojo claro buttons in my app.

0 Kudos
2 Replies
TimWitt2
MVP Alum

I wonder if you could replace the button like in this example? Edit fiddle - JSFiddle 

Maybe you can find some answers here? html - Styling an input type="file" button - Stack Overflow 

ThomasSolow
Occasional Contributor III

I don't think there's a set way to do this across browsers.  The "standard" hack is to hide the file input, use your own button, and programmatically click the hidden input when the user clicks the button.  This is pretty ugly but it works.

Webkit browsers (chrome, safari) can use this CSS pseudoselector to select the button, like this:

input[type="file"]::-webkit-file-upload-button{
  // style button here
}‍‍‍