Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

jquery - how to apply background color to the found text -


hello have following code , works fine finding , replacing string... not working globally..how make work globally , after replacing want highlight string green color.. how..?

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html>  <head>   <title> new document </title>  <script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>  <script> $(document).ready(function(){ $('#replace').click(function(){ var oldstr=$('#inputstring').val(); var newstr=$('#newstring').val(); var para=$('#para').html(); var result=$('p:contains('+oldstr+')');   if(result) { var x=para.replace(new regexp(oldstr, 'i','g'), newstr); $('#para').empty().html(x);  } }) })  </script>  </head>   <body>   enter string find:<input type="text" id="inputstring"><br>   enter string replace:<input type="text" id="newstring"><br>   <input type="button" value="replace" id="replace"><br>   <p id="para">this new paragraph written test how replace string  desired string</p>  </body> </html> 

$('body').html($('body').html().replace(oldstr, '<span style="color: green">' + newstr + '</span>')); 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -