//Invite
$("#userSelect").click(function () {
var v = $("#userSelect option:selected").text();
var text=$("#textYaoqing").val("Invited:" v);
});
$('#yaoqingBtn').click( function () {
var uIds = $('#userSelect').val();
var tId = $('#TIdHidden').val();
if (uIds ed("Please select the inviter! ");
}
else {
var param = String.Format("action=yaoqing&common={0}&tId={1}", uIds , tId);
var htmlObj = GetAjax("HandlerPage", param);
var tid = $('#TIdHidden').val();
//if (htmlObj != "OK" )
alert(htmlObj); 🎜> SkipPage("TopicSingle", "tId =" tId);
How to save the value selected in the drop-down box, but the data is gone as soon as the data is refreshed. This is var v = $("#userSelect option:selected").text();
The value selected in the drop-down box The value is saved to $("#textYaoqing").val("Invited:" v); here
Reply to the discussion (solution)
Display after refreshing, requires cookies, or save to the server.
I tried, but it didn’t work. I’m not very familiar with cookies. Can you be more specific?
When refreshing and reloading, first get the value from the cookie, and assign it to the drop-down box if it is obtained. If it cannot be obtained, it will be displayed by default
<!doctype html><html lang="en-US"><head> <meta charset="UTF-8"> <title></title></head><body><input type="text" name="" id="txt"/><input id="btn" type="button" value="test"/><script type="text/javascript"> document.getElementById('btn').onclick = function(){ var d = new Date(); d.setDate(d.getDate() + 10); document.cookie = 'value=' + document.getElementById('txt').value + ';expires=' + d; console.log(document.cookie); }</script></body></html>