[Solved] jquery onchange not working on two method i’ve tried

Why not just call val() in your change handler? dateselect = $(this).val(); $(function() { dateselect = $(‘#dateselect’).val(); $(‘#dateselect’).on(‘change’, function() { dateselect = $(this).val(); alert(dateselect); }); alert(dateselect); }); JSFiddle Link 10 solved jquery onchange not working on two method i’ve tried

[Solved] Create a sticky header and sticky sidebar? [closed]

This is a some idea for you , think a minuet you can do it <link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css” integrity=”sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M” crossorigin=”anonymous”> <script src=”https://code.jquery.com/jquery-3.2.1.slim.min.js” integrity=”sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN” crossorigin=”anonymous”></script> <script src=”https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js” integrity=”sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4″ crossorigin=”anonymous”></script> <script src=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js” integrity=”sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1″ crossorigin=”anonymous”></script> <body> <nav class=”navbar navbar-expand-md navbar-dark fixed-top bg-dark”> <a class=”navbar-brand” href=”#”>Dashboard</a> <button class=”navbar-toggler d-lg-none” type=”button” data-toggle=”collapse” data-target=”#navbarsExampleDefault” aria-controls=”navbarsExampleDefault” aria-expanded=”false” aria-label=”Toggle navigation”> <span class=”navbar-toggler-icon”></span> </button> … Read more

[Solved] Testing javascipt using jasmine

Hope your questions is not about any problem, Here i’m attaching basic things for you to understand jasmine . I guess you have already did the setup of jasmine to start writing test cases. Here is a sample example. function helloWorld() { return ‘Hello world!’; } describe(‘Hello world’, function () { it(‘says hello’, function () … Read more

[Solved] How to addClass active using on scroll but not using a href id?

Here you go with a solution https://jsfiddle.net/25fd6nov/ $(‘.click a’).click(function(e){ e.preventDefault(); $(this).parent().addClass(‘active’).siblings(‘li’).removeClass(‘active’); var id = $(this).data(‘href’); $(‘html, body’).animate({ scrollTop: $(“#” + id).offset().top }, 1000); }); .active { font-weight: bold; } <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <nav id=”menu-center”> <ul class=”click crsl”> <li class=”active”><a class=”page1 dot” data-href=”home”>Home</a></li> <li><a class=”page2 dot” data-href=”blog”>Blog</a></li> <li><a class=”page3 dot” data-href=”about”>About</a></li> <li><a class=”page4 dot” data-href=contact>Contact</a></li> </ul> </nav> … Read more

[Solved] why do developers prefer JavaScript for form validation, if it can be possible from HTML5? [closed]

From tutorialspoint: Form validation normally used to occur at the server, after the client had entered all the necessary data and then pressed the Submit button. If the data entered by a client was incorrect or was simply missing, the server would have to send all the data back to the client and request that … Read more

[Solved] How do I rewrite this javascript in jQuery? [closed]

Based on you rcomment, you want to use the reference of what is clicked. So call the function $(‘.className’).click(randomString); It will set this to the object, so inside of randomString you can use $(this).text(randomStr); function randomString() { var chars = “0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz!@#$%^&*()_+”; var string_length = 8; var randomStr=””; for (var i=0; i<string_length; i++) { var rnum … Read more