Solved

convert jquery code to javascript

Posted on 2016-10-25
3
63 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 52

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now