0

I'd created a form in a bootstrap modal window. Inside that form i use a input type text and a textarea.

<div class="modal fade" id="TestModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
    <div class="modal-content">
        <div class="modal-header">
            <h5 class="modal-title" id="exampleModalLabel">Test</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            <form>
                @*Input 1*@
                <div class="form-group">
                    <label for="input1">Input 1</label>
                    <input type="text" class="form-control" id="input1" required maxlength="75">
                </div>


                @*Input 2*@
                <div class="form-group">
                    <label for="input2">Input 2</label>
                    <textarea class="form-control" id="input2" rows="18" required></textarea>
                </div>

                <div class="row">

                    @*Select 1*@
                    <div class="form-group col-lg-4">
                        <label for="select1">Select 1</label>
                        <select class="form-control" id="exampleSelect2" required>
                            <option>1</option>
                            <option>2</option>
                            <option>3</option>
                            <option>4</option>
                            <option>5</option>
                        </select>
                    </div>

                    @*Input 3*@
                    <div class="form-group col-lg-4">
                        <label for="input3">Input 3</label>
                        <input type="text" class="form-control" id="input3" required>
                    </div>

                    @*Input 4*@
                    <div class="form-group col-lg-4">
                        <label for="input4">Input 4</label>
                        <input type="text" class="form-control" id="input4" required>
                    </div>

                </div>                   
                <button type="submit" class="btn btn-primary">Create</button>
            </form>
        </div>
    </div>
</div>

The result is as follows:Result of code

How to set the same width for the text input and the textarea as for the 3 controls below them?

5p1k3md
  • 55
  • 2
  • 8

2 Answers2

1

I solved like suggested in the second post here.

min-width: 100%

did the trick.

5p1k3md
  • 55
  • 2
  • 8
0

Do it with jQ class selector.

$(".modal-body.form-control").css("width","100px");
$(".modal-body.form-control").css("min-width","100px");
Amit Kumar Singh
  • 4,393
  • 2
  • 9
  • 22