Solved

convert jquery code to javascript

Posted on 2016-10-25
3
46 Views
Last Modified: 2016-11-01
HI,
I need to convert the following code in jquery into pure javascript :
$(".clock-input").keyup(function(e) {
        if (e.keyCode == 38 || e.keyCode == 40)
            return;
        $(".clock-drop-down").hide();
        var text = $(this).val().toLowerCase();
                $(".clock-drop-down").html(listHtml);
                $(".clock-drop-down").show();
            }

            $(".clock-autocompleteoption").on('mouseover', function() {
                $(".clock-autocompleteoption").removeClass("clock-selectedoption");
                $(this).addClass("clock-selectedoption");
            });

            $(".clock-autocompleteoption").on('click', function() {
                $('.clock-drop-down').hide();
                var jid = $(this).data('id');
                $('.clock-input').val($(this).text());
                $('.clock-filter').trigger('clock:click', jid);
            });
        }
    });

Open in new window


Thanks
0
Comment
Question by:Rohit Bajaj
3 Comments
 
LVL 51

Expert Comment

by:Julian Hansen
ID: 41859389
This is possible - but can I ask why you want to do this?
0
 

Author Comment

by:Rohit Bajaj
ID: 41859737
yes..i wrote thia code for a library which will be imported by other users..but then i realized that using jquery will make the library big...
so if i dont use jquery the size of my file will become small..which is a preference for a library

if you can help me resolve one or two expressions that would be fine..
0
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
ID: 41866530
Who told you that jquery would make your project large?  it's 84kb!! :) Given the amount of code you'd need to write to not only write it in vanilla javascript but also to be cross browser compatible you would probably be more than 84kb :)

https://www.experts-exchange.com/articles/12264/Javascript-Frameworks-what-are-they.html
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now