Search within textarea

Description

The following code shows how to search within textarea.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type="text/javascript"
  src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.css">
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){<!--   ww  w  .  j av a  2s  . c om-->
$(document).ready(function(){
  $('#doProcessLog').click(function(){
    var XMLstring = $.parseXML($.trim($('#log-a').val()));
    var out = $(XMLstring).find('note to').each(function(i, data){
      console.log(data);
    });
  });  
});
});//]]>  
</script>
</head>
<body>
  <div data-role="page" id="page">
    <div data-role="header">
      <h2>Code2</h2>
    </div>
    <div data-role="content">
      <label for="log-a">Error Log:</label>
      <textarea name="textarea" id="log-a" value="">
<?xml version="1.0"?>
<note>
    <to>Tom</to>
    <from>Jack</from>
    <heading>Reminder</heading>
    <body>Don't forget me this weekend!</body>
</note>
    </textarea>
      <a id="doProcessLog" data-role="button">Process Log</a>
      <div id="output"></div>
    </div>
  </div>
</body>
</html>
http://fiddle.jshell.net/j8Y76/show/light/

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme