Input type file styling
Input type file styling
We’ll attempt to use programming in this lesson to solve the "Input type file styling" puzzle.
You can change the styling of your default input type file button with an attractive button design. You can make it attractive using CSS style and also you can hide and trigger it using another button on click event.-
Make input type file element invisible, add button and on click button trigger click event on input file
<form method="post"> <button class="btn btn-success pull-right" onclick="document.getElementById('file').click(); return false;">Upload photo</button> <input type="file" name="image" class="image invisible" id="file" accept="image/*"> </form>
You can use bootstrap CDN which makes the input file invisible (hidden) with class invisible. You can also make the input type file invisible using visibility: hidden; with inline CSS.
Bootstrap CDN
<!-- CDN link -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Javascript
- Check if value exists in array javascript
- How to set href value of anchor tag in javascript
- Deault order of record in datatable
- Javascript to print Fibonacci series upto 15 Observations
- Uncaught SyntaxError: Identifier 'CODE' has already been declared
- How to remove duplicate values from array in javascript
- How to preview a word document in HTML using javascript
- Concat variable with string in javascript
- How can I add a key/value pair to a JavaScript object
- Custom slider js
- Uncaught TypeError: Cannot read property 'addEventListener' of undefined
- Uncaught TypeError: Illegal invocation
- How to check caps lock is on in javascript
- How to validate input type file size in javascript
- How to display for slash as a string in javascript HTML
- How to validate empty space in textbox in Javascript
- How to fixed bootstrap navbar at top on scroll
- How to add a property to object with condition in javascript
- ReferenceError: $ is not defined
- Apex bar chart - fill bar color with gradient on hover
- Apex chart bar chart
- How to Set data to localstorage in javascript
- Short-circuits conditionals
- Hide div on click outside of element in javascript/jQuery
- Copy one array to another in javascript