Solved

convert jquery code to javascript

Posted on 2016-10-25
3
128 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 55

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 43

Accepted Solution

by:
Rob 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

837 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