I am trying to get some custom jQuery working with Bootstrap, but I am still fairly new with Bootstrap.
I had a HTML 5 doc where this worked:
$('#assigned_agent_c').change(function(){
var agent_id = $('#assigned_agent_c').val();
var name = $('#assigned_agent_c :selected').text();
var phone = $('#assigned_agent_c :selected').attr('data-phone');
$('.my_name').text(name);
$('.set_phone').text(phone);
$("#user_id").val(agent_id);
});
In conjunction with this HTML:
<span class="my_name" name="assigned_agent_c"></span>
I also have a dropdown select with the id assigned_agent_c:
<div class="form-group border">
<label for="assigned_agent_c"><h2>Select User:</h2></label>
<select class="form-control" id="assigned_agent_c" name="assigned_agent_c">
<option value="" selected></option>
<option data-phone='555-555-5555' data-email='example@email.com' data-nmls='000000' data-bio='www.somesite.com' value='crm_id' data-image="<img src='http://somesite.com/images/user_bio.png' />">My User</option>
Basically, the jQuery would take the name selected in the dropdown for assigned_agent_c, and place the name in the span element. It does the same thing with the phone number and user id. How can I reporoduce this in Bootstrap?
FYI: the whole page is basically a form, so I am using the Bootstrap form elements, if that makes a difference.
Let me know if you need more info. Thanks!