
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
- Prism js horizontally overflowing its container
- Short-circuits conditionals
- Uncaught TypeError: Assignment to constant variable
- Execute function with condition in javascript
- How to pass array as arguments to function in javascript
- How to preview a word document in HTML using javascript
- How to display for slash as a string in javascript HTML
- Uncaught TypeError: Cannot read property 'addEventListener' of undefined
- How to use JavaScript to search for items in a list
- How to make entire Div clickable in javascript
- Javascript to print Fibonacci series upto 15 Observations
- How to echo array in Javascript
- How to display an image in Javascript onclick
- Copy one array to another in javascript
- Javascript set timeout function with example code
- How to fixed bootstrap navbar at top on scroll
- Check if value exists in array javascript
- Multidimensional array example javascript
- How to Set data to localstorage in javascript
- How to get query string value in javascript
- Deault order of record in datatable
- How to check caps lock is on in javascript
- ReferenceError: Cannot access 'myFunction' before initialization
- On click enter redirect to another URL with parameters in javascript
- ReferenceError: $ is not defined