[Solved] how to get user input [closed]

[ad_1] Your error is because you used the wrong ID. getNumber is the button’s ID and you need to use the input‘s ID like this : $(document).ready(function() { $(‘#getNumber’).click(function(event) { alert(localStorage.getItem(“maxnum”)); alert($(‘#input1’).val()); }); }); [ad_2] solved how to get user input [closed]

[Solved] retrieve contents of div and make image src

[ad_1] You can simply do it in jQuery by getting the text of the div and then setting the source of image like this: var source = $(“#flag-name”).text(); console.log(“before – ” + $(“#image”).attr(“src”)); $(“#image”).attr(“src”,source); console.log(“after – ” + $(“#image”).attr(“src”)); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <div id=”flag-name” style=”hidden”>en-flag.jpg</div> <img id=”image” src=”https://stackoverflow.com/questions/48871589/DIV CONTENTS HERE”> 1 [ad_2] solved retrieve contents of … Read more

[Solved] getActivity() From Fragment to Fragment returning null

[ad_1] adapter.setOnItemClickListner(new DailyMenuFrag()); The new DailyMenuFrag() here is a new fragment and it is not attached to any activity and hence getActivity() returns null. Looks like you should use adapter.setOnItemClickListner(this); instead to use the current DailyMenuFrag instance as item click listener. [ad_2] solved getActivity() From Fragment to Fragment returning null

[Solved] tokenizing and parsing with python

[ad_1] To retrieve the data from the file.txt: data = {} with open(‘file.txt’, ‘r’) as f: # opens the file for line in f: # reads line by line key, value = line.split(‘ : ‘) # retrieves the key and the value data[key.lower()] = value.rstrip() # key to lower case and removes end-of-line ‘\n’ Then, … Read more

[Solved] Construct a game so that two random numbers appear and the user has to choose which one is bigger

[ad_1] The simplest thing you can do is ask for the value of the biggest number, and compare it to the biggest number: biggest = max(a1, a2) user_num = int(input(“What is the biggest number?”)) if user_num == biggest: print(‘Correct!’) else: print(‘Wrong! The biggest number is {}’.format(biggest)) Note the use of int() for converting the input … Read more

[Solved] Sort date using lambda expression [closed]

[ad_1] What you’re ordering by here is the distance between the pivot (the birthdate) and each date. Something like this: var sorted = data.OrderBy(date => (birthdate – date).TotalDays); will sort by distance, but put all the after dates first, because the TotalDays will be negative, then the before dates. To avoid that, we need to … Read more