Wednesday 15 August 2012

cordova - Need search or find function in jquery mobile (phonegap) -


I need to implement the search functionality in my app (like note pad control f). I have a set of data that I want to search if it does not exist .Data list is not in view. As we write something in Notepad, then we search for any work. it's possible. Can you please tell me how to do it. Please provide some examples.

  • aString: Text string to search.
  • aCasensitive: Specifies case-sensitive search if the Boolean value is true.
  • One outstanding: If Boolean is true, then specifies backward search.
  • aWrapAround: If Boolean is true, then specifies wrap around search.
  • aWholeWord: If Boolean is true, then the whole word specifies the search.
  • aSearchInFrames: If Boolean is true, specifies a search in the frame.
  • A shodiolog: if the boolean is true, then specify a show dialog.


    Example:

      & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; JQuery mobile nested list & lt; / Title & gt; & Lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1" /> & Lt; Link rel = "stylesheet" href = "http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /> & Lt; Script src = "http://code.jquery.com/jquery-1.9.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Find text (str) {if (str === "") {Warning ("Please enter some text to search!"); Return; } If (window.find) {window.find (str, false, false, true, false, true, false); }} $ (Document) .on ('click', '#search', function () {findText ("blah");}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "list-page" data-role = "page" & gt; & Lt; Div data-role = "header" & gt; & Lt; H1 & gt; Search the page & lt; / H1> & Lt; / Div & gt; & Lt; Div data-role = "content" & gt; & Lt; Label = "search field" & gt; Text input: & lt; / Label & gt; & Lt; P & gt; Blah is a test blah, it's a test blah & lt; / P & gt; & Lt; Input type = "button" name = "search" id = "search" value = "search" /> & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

No comments:

Post a Comment