Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 08:29 PM
I was created a Multiple Choices by Dynamic content block as below and i was tried to create a Button for clear values, but it doesn't work ! Please someone help me !
here is the script :
<g:evaluate>
var table = new GlideRecord('sys_user');
table.orderBy('name');
table.query();
</g:evaluate>
<select id="multiple_choices" class="js-example-basic-single form-control interactive-filter__form-control select2 widget-content interactive-filter__widget-content" multiple="multiple">
<j:while test="${table.next()}">
<option value="${table.user_name}">${table.name}</option>
</j:while>
</select>
<button onclick="clearValues()">
Clear Values
</button>
<script>
$j(document).ready(function() {$j(".js-example-basic-single").select2();});
function clearValues() {
document.getElementById("#multiple_choices").value = "";
}
</script>
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 10:15 PM
I fixed the script as below and it's working :
function clearValues() {
$j( ".select2-choices" ).empty();
}
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 10:15 PM
I fixed the script as below and it's working :
function clearValues() {
$j( ".select2-choices" ).empty();
}