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???? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.