<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jquery</title>
</head>
<body>
<input type="text" id="text">
<script type="text/javascript"> var wzw=function(id){
this.ele=document.getElementById(id)
return this;
} // Set up class
wzw.prototype.setClass=function(classN){
this.ele.className=classN;
return this;
} // Remove the specified class
wzw.prototype.removeClass= function(classN){
this.ele.className=this.ele.className.replace(classN,"");
return this;
}; // Click on the way
wzw.prototype.click= function(fn){
if (this.ele.addEventListener){
this.ele.addEventListener("click",fn,false);
}else{
this.ele.attachEvent("onclick",fn);
};
return this;
}; // hover
wzw.prototype.hover= function(overfn,outfn){
this.ele.onmouseover=overfn;
this.ele.onmouseout=outfn;
return this;
}; // Add specified class
wzw.prototype.addClass= function(classN){
this.ele.className=this.ele.className+" "+classN;
return this;
};
// Judge whether there is a specified class
wzw.prototype.hasClass=function(classN){
if (this.ele.className.match(classN)){
return true
}else{
return false
};
} // Set up css
wzw.prototype.css=function(k,v){
if (v){
this.ele.style[k]=v;
}else if(!v){
for(key in k){
this.ele.style[key]=k[key];
}
}else{
console.log(" Parameter error ")
}
return this;
} // Use $ Wrap it
function $(id){
return new wzw(id)
} $("text").setClass("wangzw").css({border:"2px solid #f00",width:"400px",height:"20px",fontSize:"20px",padding:"5px 10px",outline:"none",borderRadius:"5px"}).removeClass("wangzw").hover(function(){
this.style.background="rgba(220,230,240,.2)";
},function(){
this.style.background="";
}).click(function(){
this.value="000000"
});
</script>
</body>
</html>

simulation jquery More articles about

  1. simulation jQuery Simple packaging ajax

    /* simulation jQuery Writing ( Simple writing )*/ var $={}; /*ajax*/ $.ajax = function (options) { /* * request * 1. Request interface type get po ...

  2. simulation jQuery library

    use js simulation jQuery Method , Experience the idea of encapsulation <!DOCTYPE html><html><head><meta charset="UTF-8" ...

  3. ajx Technical analysis and simulation jQuery encapsulation

    1. Background handler <%@ page language="java" contentType="text/html; charset=UTF-8" page ...

  4. simulation JQUERY Delay method binding for

    simulation JQUERY Delay method binding for , For deferred method binding , Different languages have different descriptions What a callback , Function pointer , Entrust , Events, etc , In fact, that's the big deal , But make good use of these features , It's very good for extension and Architecture , The benefits are naturally ...

  5. js Frame package , simulation jQuery encapsulation

    simulation jQuery frame , Use the original js technology , Encapsulates a js frame , To deepen to jQuery Common use of api The use of and understanding of object-oriented principles : One : The structure part first uses closures , Construct a self executing function , And then using the selector function Sizzle, a ...

  6. angularJs How to simulate jQuery Medium this?

    Recently I am learning angularJs, Learning ng-click when , Because you want to get the current click element itself , I began to think of using $index To get the index of the current element can also achieve the effect I want , But in some special cases , Use $index ...

  7. simulation jQuery Medium ready Method and implementation of loading on demand css,js The sample code

    This article introduces simulation jQuery Medium ready Method and implementation of loading on demand css,js The sample code , Friends in need can refer to     One .ready Function implementation often uses jQuery In a class library or other class library ready Method , occasionally ...

  8. Native JS simulation jQuery $

    simulation jQuery Of $ Selectors Use... When getting elements ID Selectors , It returns an object : Using a class selector or label selector, the return can be a set of elements : Encapsulate the acquired one or a group of elements into a TQObject What is? ...

  9. simulation jquery Chained access

    Write code all the time, write code , Blogs are dying out , January is coming to an end , I can't help but leave some memories , Hey , Just studied jquery Chain access to , So easy to use skills, I quickly get Now , Slightly revised after study , Simulate a simple chained access , The following code supports modification ...

  10. html select Beautify the simulation jquery plug-in unit select2.js

    Code display :http://www.51xuediannao.com/demo.php Code instructions : select2.js It's a html select Beautify the simulation class jquery plug-in unit , however select2.js It's far away ...

Random recommendation

  1. linux Lower installation python Environmental Science

    1.linux Lower installation python3 a. Prepare the compilation environment ( If the environment is not right , There may be problems , such as wget Unable to download https Linked files ) yum groupinstall 'Development To ...

  2. git stash brief introduction

    original text :http://gitbook.liuhui998.com/4_5.html One . Basic operation When you're doing a complicated job , I found a job that is not related to my current job, but is very annoying bug. You want to fix it first bug Do it again ...

  3. Codeforces 682B New Skateboard(DP)

    The question is about a string of numbers. How many substrings do they represent ( There can be leads 0) Can be 4 to be divisible by . dp[i][m] Representation string 0...i in mod 4 by m The number of suffixes of By means of i-1 add to str[i] Character transfer , Or with st ...

  4. java The multithreading : Thread objects are some api

    One :wait() Method ,wait(long timeout)---> Lock object call wait() Method , Make the current thread small a Enter the waiting state , Block up , And give up the lock owned by the leading thread .---> Until other threads call with lock objects n ...

  5. Personal notes mysql The cursor

    After testing ,mysql A cursor is a structure that cannot read the calculation of a custom function ,mysql The calculated value of the built-in function can be read .

  6. tmux Brief introduction

    What is? tmux tmux Full name terminal multiplexer, It's a terminal reuse software . It can help us easily manage multiple terminal sessions . Let's introduce tmux Some nouns involved in window window pane Panes ...

  7. jenkins Conduct andriod pack , Upload dandelion

    Environmental Science :macos jenkins sdk gradle 1. Construction operations note : mac On the computer choice invoke gradle task Values are :clean 2. Create another task Then proceed gradle Add parameters ...

  8. SpringMVC Receive request parameters and page parameters

    1.Spring Receive request parameters 1>. Use HttpServletRequest obtain @RequestMapping("/login.do") public String log ...

  9. adb Mobile Testing

    1. Android Introduce Android yes google An open mobile operating system dominated by the company , But now it's beyond the limits of mobile phones , And the operating system on the mobile device . Android The original meaning of the word refers to “ robot ”, The reason is very simple ...

  10. install gradle

    Gradle It's a kind of process building tool now , At present, it is basically the same as Maven Divide the world equally , And there's a tendency to replace it . This tutorial teaches you how to linux Installation on Gradle. One . Get one linux The server To be in linux Lower installation gi ...