I would like to obtain the value of an attribute (here the title) of a dynamic button (created by the multiselect library) and display it in a text box, if there is a change.
Here's what I have now:
// for combine checkbox value
$(function() {
$('input').on('click', function() {
var values = [];
$('input[name=test]:checked').each(function() {
values.push($(this).parent().text());
});
$('[name="result"]').attr({
value: values.join('|')
});
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form oninput="txtrequete.value = (
txtdomain.value + ';' + result.value).replace(/\s+/g, '');" class="form-horizontal form-label-left">
FINAL
<div>
<input type="text" name="txtrequete" disabled="disabled" size='70'>
</div>
TEXT TEST FOR CONCAT
<div>
<input type="text" name="txtdomain" id="domainId" value="testvalue" />
</div>
CHECKBOX TEST FOR CONCAT
<div>
<label><input type="checkbox" name="test" /> test3</label><br />
<label><input type="checkbox" name="test" /> test4</label><br />
<input type="text" name="result" disabled="disabled" />
</div>
<div>
BUTTON CREATED FROM MULTISELECT JQUERY LIBRARY
</div>
<button type="button" class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" title="India, United State, Canada, Taiwan" aria-expanded="true">
<span class="multiselect-selected-text">4 selected</span> <b class="caret"></b></button>
<div>
<input type="text" name="spantitle" disabled="disabled" value="i would like the title value 'India, United State, Canada, Taiwan' HERE from the button attribute if change" size="70" />
</div>
</form>
has anyone ever used this before? Thank you in advance
<button type="button" class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown"
title="India, United State, Canada, Taiwan" aria-expanded="true">
<span class="multiselect-selected-text">4 selected</span>
<b class="caret"></b></button>div>
<input type="text" name="spantitle" disabled="disabled"
value="i would like the title value 'India, United State, Canada, Taiwan' HERE from the button attribute if change"
size="70" />
</div>