local visible text search on current web page - javascript

I need to do a local search visible text on a single simple html page. Users can simply use Ctrl+F to do that, but I would like to add a search box on the page to do the search instead. I thought of a couple ways to do this:
1- By forcing the browser's Find tool when a button on the page is clicked.
2- By a javascript/Jquery plugin that do LOCAL search on the current page.
I searched for both solutions but was not able to find anything useful. Does anyone here have any suggestions?

You can give a common class name to the tags that contains the display text and perform a search based on that class name. I had attached a link for your reference. you can make use of that funtion and call that function from a button click.
Generic Search in HTML Page

Related

How do I make specific inputs go into another .html file in the project?

I wanted to make specific inputs go into another part of a site (e.g. https://myexamplesite.com/anotherpartofit.html)
And also make those specific inputs be the ones that someone saved it in.
An example of what I think would work is: Get value from input 1 from /apartofit.html and put it in input 2 at /anotherpartofit.html and make it non-editable
If it needs to use a database, I would prefer if you could help me with firebase (Google's Database). But in my knowlege, it probably needs to use javascript, so I'll be tagging it, if it doesn't, let me know!
in visual studio or notepad or every offline web creating spaces you can't but if you buy a domain or simple , online site , you have to crate a page and get the link of that page then open another page create a button set the button's href to link of pervious page finally hit the button !

Using client side scripting to control an SAPUI5 app

So, we have an existing app, which I think is built on sapui5 if I am not mistaken. It's pretty much a simple search function app. I reviewed the DOM and noted that the search box form has the ID of #__xmlview0--searchField-F, and the search box container including all is under #__xmlview0--searchField and the actual text entry area is under #__xmlview0--searchField-I. Essentially, it looks something like this - highly simplified:
<div id = "__xmlview0--searchField">
<form id = "__xmlview0--searchField-F">
<input type = "search" id = "__xmlview0--searchField-I" />
<div id = "__xmlview0--searchField-search"></div>
</form>
</div>
There are two pages that I am interested in, one is the original start page for searching, and the other is the search page with results displayed, which also contains the same search box so that users can quickly perform another search. Lets call these start page and results page.
Since the app doesn't seem to take any QS for search strings, I was wanting to create a nested page where I can simply pass on the elements of searching into the app generated page, and display search results with one click, instead of having the users need to do them manually and transcribe things from one place to the search function.
I have attempted initially to simply change the value of the search box and then submit the search:
$("#__xmlview0--searchField-I").val("SOMETHING");
$("#__xmlview0--searchField-F").submit();
Such approach did not work. It appears that the submit will execute for the start page, but will not for the results page. But even with the start page where submit executed, the search text of "SOMETHING" has been lost for sure somehow. So I tried typing in text manually and only doing:
$("#__xmlview0--searchField-F").submit();
Which seems to show the submit button working (also only for start page, not for results page), though it appears that "SOMETHING" is still lost somehow even though I manually entered the text when executed in start page. Thinking something may be wrong with clicking the submit mechanism programatically, I tried only doing:
$("#__xmlview0--searchField-I").val("SOMETHING");
and then manually click the search execution icon (also tried pressing "enter"). But to my dismay, despite the DOM display the changes for the input search field properly, the search did not execute though the button blinked so I am sure I properly clicked it at least.
So I thought, maybe I need to trigger some kind of event before I start making changes to the search field to prompt proper event execution behind the scenes so that the input text will be recognized properly when changed:
$("#__xmlview0--searchField-I").focus();
$("#__xmlview0--searchField-I").val("SOMETHING");
$("#__xmlview0--searchField-I").focus();
$("#__xmlview0--searchField-F").submit();
But that did not work either. I am pulling my hairs out trying to figure out what may be going on. Can someone who knows the SAPUI5 stuff give me some insight? Am I doing something that is simply not possible under this environment?

firebug find javascript function source

With firebug, I'm having a difficult time locating jspaginate.init Javascript function in page https://discussions.apple.com/thread/7629335. This is in reference to How to I find javascript source in web page?
I've gotten this far. Now, how do I go about finding the function?
Here is the list of whatever they are that I see:
Click the script tab. Type in the name in the search file. In this case, type jspaginate.
When you click on the search field, a pull down menu appears. Be sure that "multiple files" is checked. Should search as you type. Doesn't tell you if multiple items have been found. You need to click on the down arrow until you find the function jspaginate.

Store and load JavaScript variables via Json

I need to store some dynamic variables in a Json file (i was told this would work) to be able to load them in multiple pages. Per example a customer should be able to select one thing in one page (a highlighted div) and then go to another page, select some items there and be able to go pack to the other page and that div is still selected. (Variables remembered) Now i tried to google and search here but found nothing matching my description. Please help me!
Try using localstorage, store selected values by user in localstorage and check this at page ready or load if it exists in loacalstorage show that value or div with highlight as per your functionality and if localstorage doesn't had a value then consider it as first time user come to this page.
but be careful using localstorage as you have to clear it when you done with it, it may cause memory leakage problem.

Javascript without form?

I'm building shopping mall website using Yahoo solution. My products have multiple options which are dependent on previous options. The problem is that in Yahoo, I have to locate options in the order form to appear in checkout page. Nested form doesn't work, of course. Here is one sample page:
http://parseven.com/sample-1.html
Can anybody help me please?
Your question is not very clear, but if I understand you correctly what you need is instead of using document.formname.subcategory.options[0] use document.getElementsByName("subcategory")[0].options[0].
document.getElementsByName("subcategory") will return you an array of all element on the page with the name="subcategory", from there you select the first one [0]. After that you can access all of its options.
I would suggest giving your dropdown an id instead of the name. Then you can use document.getElementById("unique-dropdown-id") and that will return you a reference to the select element, instead of array.
Adding more information based on new comments:
In order to make your new example (http://parseven.com/java_ex.html) work without form, remove opening and closing form tags from the page all together. Search for "document.formname.subcategory" and replace it with "document.getElementsByName("subcategory")[0]" and everything will work exactly the same way is it works now.
Since you need to submit your information to Yahoo, you have to keep form tag around, but you can't nest one form tag inside the other. Just leave the Yahoo's form tag intact and remove you other form tag.

Categories