Jquery how to find and replace content


Here you will find a  free php scripts, php resources, php tutorials, web resources , jquery

<?php print "welcome to source world-php jquery script"; ?>

WHAT IS JQUERY?

JQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.jQuery is designed to change the way that you write JavaScript.

If you want to do some kind of find and replace html content then here is example. 
For example if you want to search for string "joomla" in any table in your html and want to replace it with "wordpress".So what you have to do is first find all table tr which contains string "joomla".Now suppose you know that the string is in 0 column of table then replace it with "wordpress"
 
example find and replace with jquery

<script language="javascript" type="text/javascript">
     var $rn = jQuery.noConflict(); //Jquery no conflict 
     $rn('#replacecont').click(function()  {  
     var obj  =$rn(" table tr:contains('Joomla')");       
      $rn(obj).find("td").eq(0).html("<b>Wordpress</b>");
});

   </script>  
 
Download full example


Download

Buy Me a Beer-If you are like this post

 If you does not have paypal account create free account create account

No comments:

Post a Comment