Solved

convert jquery code to javascript

Posted on 2016-10-25
3
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 56

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…

730 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