I need get "perma" value to button when is selected option in dropdown menu.
I have this HTML:
<div class="dropdown-list">
<div><a href="#3303" perma="http://test.com/xxxx/"></a></div>
<div><a href="#3304" perma="http://test.com/xxxx2/"></a></div>
<div><a href="#3305" perma="http://test.com/xxxx3/"></a></div>
<div>
When is selected some div, perma attribute should somehow write into this :
<a href="perma">button</a>
Dropdown list Jquery:
//.input-dropdown
jQuery('.input-dropdown input, .input-dropdown > i').on('click',function(){
var elThis = jQuery(this);
var elParent = elThis.parents('.input-dropdown');
var elDropdownList = elParent.find('.dropdown-list');
if( elDropdownList.is(':visible') ){
elDropdownList.stop(true, true).slideUp(300);
}else{
elDropdownList.stop(true, true).slideDown(300);
}
});
jQuery('.input-dropdown .dropdown-list a').on('click',function(e){
e.preventDefault();
var elThis = jQuery(this);
var elParent = elThis.parents('.input-dropdown');
var elDropdownList = elParent.find('.dropdown-list');
var elInput = elParent.find('input');
elInput.val(elThis.data('value'));
elDropdownList.stop(true, true).slideUp(300);
});
jQuery(document).click(function(event) {
if(!jQuery(event.target).closest('.input-dropdown').length) {
if(jQuery('.input-dropdown .dropdown-list').is(":visible")) {
jQuery('.input-dropdown .dropdown-list').stop(true,true).slideUp(300);
}
}
});
What i tried:
<script>function gotosite() {
window.location = document.getAttribute("perma").perma;
}</script> <button id="go" onclick="gotosite()">Go</button>
<a href="<?php echo $row['perma'];?>">button</a>