The input field is lacking in showing icons on the screen

Looking for some help with my code. I'm trying to display a bootstrap icon instead of a button. Can anyone spot what's causing the issue?

<input type="submit" value="Update" class="btn btn-default btn-update" />

I attempted the following without success. Any suggestions on how to fix it?

<input type="submit" value="Update" class="glyphicon glyphicon-remove" />

Also tried this approach:

<input type="submit" value="Update" class="btn btn-default glyphicon glyphicon-remove" />

Answer №1

According to the Bootstrap documentation:

Avoid mixing with other components. Icons classes are not meant to be directly combined with other components. It is recommended not to use them along with other classes on the same element. Instead, create a nested <span> and apply the icon classes to the <span>.

Therefore, it is suggested to do the following:

<button type="submit" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-remove"></span>Update</button>

Here's an example on Bootply

Answer №2

When working with the input tag, it's important to note that it cannot contain any other HTML elements within it. Therefore, the recommended approach is to utilize the button tag instead:

<button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-remove"></i> Update</button>

View example in official documentation

Check out the live demo here

Answer №3

Customize your submit button using CSS


input[type=submit] {
        background: url(path_to_your_image);
        border: 0;
        display: block;
        height: _image_height;
        width: _image_width;
    }

Alternatively, you can use an image input:

 <input type="image" src="/yourImage" width ="" height="" border="0" />

Answer №4

To start, begin by downloading the Bootstrap folder from this link: https://github.com/twbs/bootstrap/releases/download/v3.1.1/bootstrap-3.1.1-dist.zip

After downloading, unzip the folder and upload the files to your server. Then, include the following lines in your header:

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to leverage the most recent iteration of three js

Having trouble using the newest version of three.js (r102) in IE. I keep getting an ImageBitMap error (ImageBitMap is not defined). Any tips on how to solve this would be greatly appreciated. Thanks! ...

A feature to reveal additional content when it extends beyond a single line

<div class="questionnaire-description col-xs-12" id="questionnaire_description_wrapper"> <text-truncate> <span ng-class="questionnaire_description.show_more ? 'full-description' : 'ph-ellips ...

Tips for inserting a page break after every item in a loop in Visualforce when generating a PDF document

I need help with rendering a VF page as PDF. The VF page iterates over a list of account records using the repeat tag. I want to apply a page break for each element in the repeat tag. The code below is working, but it has an issue - it shows an empty PDF p ...

Could someone please help me identify the mistake in this code? I recently created a new class, imported it into a .ts file, and then proceeded to define

Upon checking the console, an error message appeared stating that Recipe was not defined. To resolve this issue, I made sure to include the necessary class definition in a separate file at the end of my code. The import statement: import { Recipe } from ...

Tips on stopping the display of the search input name

I am a beginner and still getting the hang of things. The code below is functioning correctly, but I'm unsure how to hide the search input name from appearing on the page. Please see the image attached below as well. Thank you for your assistance in a ...

Use jQuery to populate a span element with information that is solely obtainable within a foreach loop during the rendering of buttons

I am currently navigating through learning MVC, and I have hit a roadblock. Working with Web Forms was more familiar to me, so I find myself struggling quite a bit with this new framework. After dedicating most of my day to it, I realize I need some assist ...

"Organizing an object array based on a specified order array - a step-by-step

My task involves rearranging objects within an array. Let's assume this is the data array provided: const data = [ { id: 'ETHUVMY0m', name: 'item 1', value: 'value 1' }, { id: 'McfTB40vO', name: 'item ...

Encountering a TypeError indicating that the asterisk is not functioning as a proper function

Whenever I run my server.js file, an error keeps popping up: TypeError: routing is not a function This occurs in the following line of code: routing(app); In my routing.js file, the content looks like this: // JavaScript source code var friends = requ ...

Encountering a Node.js error when trying to insert a row in a

Currently facing an issue with inserting a row into my database table. Below is the structure of the table : mysql> describe emprunt; +------------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | De ...

Interactive Bootstrap 4 button embedded within a sleek card component, complete with a dynamic click event

I am trying to create a basic card using bootstrap 4 with the following HTML code. My goal is to change the style of the card when it is clicked, but not when the buttons inside the card are clicked. Currently, clicking on the test1 button triggers both ...

Is there a way to refresh my list following a POST request when utilizing a separate endpoint?

I'm struggling with updating my list after a POST request. I haven't been able to find any solutions online. Typically, I would just push an object into an array, but it seems different in this case. This function utilizes 2 API endpoints. The f ...

Retrieve the value from an object using a dot notation in its title

Currently, I am experimenting with creating a Facebook chatbot. To communicate with Facebook, I need to verify that I own the URL provided to Facebook in the Webhooks panel. I have set up an express route that appears as follows: app.get('/api/verif ...

Unfortunately, the datepicker feature does not seem to work properly on elements that have been dynamically added through the

My code progress so far is as follows: $('body').on('change', '.dropdown', function() { $.ajax({ success: function(res) { if(res.success == true) { return elements that have the class ...

Tips on optimizing website performance by implementing lazy loading for images and ensuring they are ready for printing

Many websites feature an abundance of images, prompting the use of lazy loading to enhance load times and reduce data consumption. But what happens when printing functionality is also required for such a website? One approach could involve detecting the p ...

Clicking the Bootstrap NavBar Collapse does not trigger the expected functionality

I'm having some issues with the collapse button in my navbar. Whenever I click on the navbar button, the collapsible section doesn't open. I suspect that there might be an issue with the data-toggle function not properly toggling the collapse. ...

Navigating to the specific item that a directive is linked to

I am looking to develop a directive that can be applied to elements to adjust their maximum height to be equal to the height of the window minus the distance from the top of the element to the top of the window. I have attempted it in the following manner ...

conducting a remote call via javascript

Looking for a way to achieve the same functionality as a link_to ... remote=> true using JavaScript? It may not even be necessary - Imagine having a div containing the user's name and profile picture. My goal is to have the entire div react to a ...

Utilize the selection from a dropdown menu on a website while using Internet Explorer

I need help implementing the selected value from a dropdown on a website. Within the HTML source code, there is a button tag. When I click this button (button.click), I am able to choose the desired value from the dropdown for all tags with the class "dro ...

Obtain the Angular 2 Form object within a TypeScript class file for manual configuration of form properties

I have a form inside a PrimeNG dialog control. I need to handle two different submit methods based on certain conditions for this form, so I don't want to use the ngSubmit method in the form tag. Instead, I want to manually access the form object in m ...

Having trouble finding a solution to prevent code from automatically adding a class in jQuery/JavaScript?

I am currently in the process of customizing the FlexNav Plugin. I have made a modification to allow sub-menus to open on click instead of hover. However, a new issue has arisen where it requires two clicks to open a submenu. Upon investigation, I have i ...