Total members 11890 |It is currently Fri Apr 19, 2024 2:18 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





append text,prepend text,add text after element and add text before element
Code:

<html>
<
head>
<
title>append,prepend,add after and add before</title>

<!--
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
 Note you can download the JQuery package instead of using Google version. --> 
<script src="jquery-1.8.3.js"></script>
<script>
$(document).ready(function(){
  $("button#B1").click(function(){
    $("#part1").append("appended text");
  });
  
    $("button#B2").click(function(){
    $("#part2").prepend("appended text ");
  });
  
   
  
        $("button#B3").click(function(){
    $("#link").after(" added after text here ");
  });
  
        $("button#B4").click(function(){
    $("#link").before("before text ");
  });
  
  
});
</script>
</head>

<body>
<button id="B1">Append</button>
<button id="B2">Preappend</button>
<button id="B3">Append After Element</button>
<button id="B4">Append Before Element</button>
<div id="part1">Text area1 </div>
<div id="part2">Text area2 </div>
 
<a href="#" id="link"  target="_blank" >Sample</a>
 
 
</body>
</html>





_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : append,prepend,add after and add before
 Append string in C++     -  
 Append to file using php     -  
 stream filter to append     -  



Topic Tags

JQuery Content
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com