jijodasgupta Posted February 25, 2009 Share Posted February 25, 2009 hey guys...i hav a code tht searches a word from twitter and displays all messages tht contain tht word.... <script type="text/javascript"> $(document).ready(function(){ $('form#search').bind("submit", function(e){ e.preventDefault(); $('#content').html(''); var query = urlencode($('input[name="searchTerm"]').val()); //what to search for var rpp = 20; //number of tweets to retrieve out $.getJSON('http://search.twitter.com/search.json?callback=?&q='+query+'&rpp='+rpp, function(data){ $.each(data.results, function(i, item){ console.log(item); var newDiv = '<p><a href="http://www.twitter.com/'+item.from_user+'">'+item.from_user+'</a> - '+item.text+'</p>'; $('#content').append(newDiv); }); }); }) function urlencode(str) { return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40'); } }) </script> /code] i puttin the outputs into a <div>... my problem is.....i want to highlight the searched word in the div... how do i do tht???? Link to comment https://forums.phpfreaks.com/topic/146893-highlighting-a-word-in-div/ Share on other sites More sharing options...
darkfreaks Posted February 27, 2009 Share Posted February 27, 2009 http://www.tedpavlic.com/post_simple_inpage_highlighting_example.php Link to comment https://forums.phpfreaks.com/topic/146893-highlighting-a-word-in-div/#findComment-772231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.