Date : March 29 2020, 07:55 AM
Any of those help You can use following style and if you want bigger then increase padding. input, button{
padding: 7px;
}
|
Bootstrap-How to make the bootstrap input dropdown buttons selectable-Jquery
Tag : jquery , By : Sascha Brossmann
Date : March 29 2020, 07:55 AM
|
How to display input buttons on one line in Bootstrap?
Tag : html , By : cnemelka
Date : March 29 2020, 07:55 AM
hop of those help? You'll need to make the column width wider. Since you're using col-lg-3 class, the last button is wrapping to the next line. Try changing it to a larger column (i.e. col-lg-6). To answer the second part of your question, you can add a CSS rule like .btn {margin: 0 5px;} if you want some space between the buttons.
|
Having 3+ Input Fields on a Single Line in Templated Bootstrap Razor View
Tag : css , By : jazzyfox
Date : March 29 2020, 07:55 AM
With these it helps First, each form-group automatically gets its own line. It employs a clearfix to ensure that nothing else wraps around it. Second, even if it didn't, each of your label/field combos are consuming 12 columns. Since there's only 12 columns to work with in the Bootstrap grid, each would wrap to a new line anyways. There's two options here. If you want multiple fields on the same line, under the same label, you can simply put them all within your col-md-10 div within the form-group: <div class="form-group">
<label class="control-label col-md-2" for="@Html.IdFor(m => m.FirstName)">Name</label>
<div class="col-md-10">
<div class="row">
<div class="col-md-4">
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
</div>
<div class="col-md-4">
@Html.EditorFor(model => model.MiddleName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.MiddleName, "", new { @class = "text-danger" })
</div>
<div class="col-md-4">
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(model => model.MiddleName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.MiddleName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.MiddleName, "", new { @class = "text-danger" })
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
</div>
</div>
</div>
</div>
|
Can't submit the right button for each input field [multiple buttons and input fields in a single form]
Date : March 29 2020, 07:55 AM
I wish this help you EDIT: I might be approaching this problem the wrong way.. Now im thinking maybe i should find the button that was clicked and then get the previous element's value <div class=verktyg>
<form action='sell_items.php' method='POST' id='ajax'>
<table class="inventory">
<tr>
<td class='verktyg-first-td'>Item 1</td>
<td>10</td>
<td>
<input type='number' name='item_1' value='10'>
</td>
<td>
<button type='submit' class='submit_button'>sell</button>
</td>
</tr>
<tr>
<td class='verktyg-first-td'>Item 2</td>
<td>20</td>
<td>
<input type='number' name='item_2' value='20'>
</td>
<td>
<button type='submit' class='submit_button'>sell</button>
</td>
</tr>
</table>
</form>
</div>
// prevent for submission
$("form").submit(function(e) {
e.preventDefault();
});
// when submit button is clicked
$(".submit_button").on("click", function() {
self = $(this);
form = self.closest("form");
url = form.attr('action');
type = form.attr('method');
parentTr = self.parent("td").closest("tr"); // get the parent <tr>
data = {};
inputElm = parentTr.find("input[type=number]"); // find input element closest to the clicked button
name = inputElm.attr('name'); // get input name
value = inputElm.val(); // get input val
data[name] = value;
// send ajax request
$.ajax({
url: url,
type: type,
data: data,
success: function(response) {
console.log(response);
}
});
});
<td>
<input type='number' name='item_1' value='10'>
<button type='submit' class='submit_button'>sell</button>
</td>
<button type='submit' class='submit_button' name="item" value='button_value'>sell</button>
// get button val
value = self.val();
name = self.attr('name');
data[name] = value;
|