The use of JQuery replacewith ReplaceAll end

Source: Internet
Author: User

The use of JQuery replacewith ReplaceAll end

<%@ Page Language="Java"Import="java.util.*"pageencoding="UTF-8"%><%    StringPath=Request.getcontextpath (); StringBasePath=Request.getscheme ()+ "://" +Request.getservername ()+ ":" +Request.getserverport ()+Path+ "/";%><!DOCTYPE HTML><HTML><Head><Basehref= "<%=basePath%>"><MetaCharSet= "UTF-8"><title>B Index</title><Linkrel= ' stylesheet 'type= "Text/css"href= ' B/css/bootstrap.css '></Head><Bodystyle= "margin:150px;">    <DivID= "div001">div001</Div>    <DivID= "div002">div002</Div>    <DivID= "div003">div003</Div>    <P><span>Hello</span>, How is it?</P>    <Div>        <ButtonID= "btn001">Click me to replacewith new paragraph</Button>        <ButtonID= "btn002">Click me to ReplaceWith div003</Button>        <ButtonID= "btn003">Click me to replacewith all div with pibib</Button>        <ButtonID= "btn004">Click me to paragraph ReplaceAll div001</Button>        <ButtonID= "btn005">Click me to paragraph replaceall div001 use end</Button>        <ButtonID= "btn006">Click me to use End</Button>    </Div>    <Scripttype= "Text/javascript"src= "Js/jquery-1.11.1.js"></Script>    <Scripttype= "Text/javascript"src= "B/js/bootstrap.js"></Script>    <Scripttype= "Text/javascript"src= "Js/index028.js"></Script></Body></HTML>
$(function() {    $(' #btn001 '). Click (Btn001click); $(' #btn002 '). Click (Btn002click); $(' #btn003 '). Click (Btn003click); $(' #btn004 '). Click (Btn004click); $(' #btn005 '). Click (Btn005click); $(' #btn006 '). Click (Btn006click);});functionBtn001click () {//the writing of ' <P>ASDF ' is also possible;$ (' #div001 '). ReplaceWith (' <p>asdf '));}functionBtn002click () {$ (' #div001 '). ReplaceWith ($ (' #div003 '));}functionBtn003click () {//' <p><i><b><i><b>asdf ' such a writing, jquery self-sealing;    //can also remove the wrong </ul>;$ (' div '). ReplaceWith (' <p><i><b></b></ul><i><b>asdf '));}functionBtn004click () {//in this case "<P>THISISPA" unexpectedly is invalid, must oneself seal;    varRes = $ ("<p>this is Pa</p>"). ReplaceAll ($ (' #div001 ')));    Console.log (RES); //no need to add back;    //$ (' #div002 '). before (res);}functionBtn005click () {//with no end () will be replaced;    varRes = $ ("<p>this is use end</p>"). ReplaceAll ($ (' #div002 ')) . end (); Console.log (res);}functionBtn006click () {//Obj2 got a [document] object    varObj2 = $ (' p '). end (); //obj Gets the [P] object    varobj = $ ("P"). FIND ("span"). end (); Console.log (obj);}

The use of JQuery replacewith ReplaceAll end

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.