Solved

convert jquery code to javascript

Posted on 2016-10-25
3
261 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 57

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

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

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

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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…

688 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