Hi there,
I'm using a dynamic select field to let users change the blog's folder that is displayed. It seems to work fine, the only issue is that the current folder isn't selected when I'm on that specific page. Is there a way to let the current folder be the selected option?
This is my HTML:
And script:
Thank you in advance
I'm using a dynamic select field to let users change the blog's folder that is displayed. It seems to work fine, the only issue is that the current folder isn't selected when I'm on that specific page. Is there a way to let the current folder be the selected option?
This is my HTML:
- Code: Select all
<select id="dynamic_select">
<option value="<cms:link masterpage='news.php' />">All</option>
<cms:folders masterpage='news.php' orderby='weight'>
<option value="<cms:show k_folder_link/>"><cms:show k_folder_title /></option>
</cms:folders>
</select>
And script:
- Code: Select all
$(function(){
// bind change event to select
$('#dynamic_select').on('change', function () {
var url = $(this).val(); // get selected value
if (url) { // require a URL
window.location = url; // redirect
}
return false;
});
});
Thank you in advance
