0

Below is an example of Bootstrap Code to create a input-group. How can I use jQuery to set the contents of the input-group using the id?

<div class = "container">
<div class = "input-group-addon">Your name</span>
<input type="text" class="form-control" id="inputField" placeholder="Full Name">
</div><br> 

Also, is there a way I can make the input-group not editable. I want to use it to display read-only text.

$("inputField").???? <-- What goes here??

Thanks!!

2 Answers 2

1
$("#inputField").attr('readonly',true).val('myValue')

if you have access to the html put directly readonly="readonly" as attribute of input. you can put value directly in HTML with the value attribute. ps: dont forget the "#"

Sign up to request clarification or add additional context in comments.

Comments

1
$('#inputField').val('the value');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.