Save in browser password and username where username from <select> element

Simple login form

<form>
<select id="accessLevel" autofocus>
    <option value="1">View</option>
    <option value="2">Control</option>
    <option value="3">Service</option>
</select>
<input id="password" type="password" required>
<button type="submit">Login</button>
</form>

Is there any way to store chosen text in element as username in “save password” function of browsers.


Source: stackoverflow-javascript

prevent scroll resetting after dom mainpulation

i’m using an external plug-in that manipulate the dom which in turn cause vertical scroll reseting on clicking

i know there is similar questions but non of them worked for me

i’ve tried handling it on ‘change’ but it never fired the event

$(document).on('change', '.element', myfunc());

the function absolutely have to remove and place element, there is no way to hide or change value, any suggestions are highly appreciated

i did try to check hash anchor solution for tips and pointers but failed miserably, same thing with focus

is there anyway to handle that resetting so i would prevent it ?


Source: stackoverflow-javascript