javascript - Bigcommerce - Is it possible to change text after a function executes? -


i'm working on site right now, , there text want change. site has search feature in header, , after type 3 or 4 characters in input field, product list drops down listing products have characters in product name (similar to: http://www.lightexports.com/). want change text appears @ bottom of list, "view results".

i tried using .replace() function doesn't work, , can't use window.onload because if never use search, code never gets loaded on site. code display list of products , text want change appears after start typing in search bar.

**note: platform i'm using bigcommerce , allows html, css, , javascript.

any appreciated. in advance , happy coding!

i've figured out. best way7 accomplish this:

  1. download quicksearch.js file loads on site -- queued in snippets/quicksearchjs.html , can download navigating yourstore.com/javascript/quicksearch.js.

  2. upload file webdav folder /template/js/

  3. in snippets/quicksearchjs.html snippet file, can edit bigcommerce backend "design > edit html/css" page, comment out original <script> tag , add tag point js file uploaded webdav. new snippets/quicksearchjs.html file should this:

    <!-- <script type="text/javascript" src="%%global_cdnapppath%%/javascript/quicksearch.js?%%global_jscachetoken%%"></script> -->      <script type="text/javascript" src="%%asset_js/quicksearch.js%%?%%global_jscachetoken%%"></script> 

(yes, know syntax looks weird because of way asset used , way cachetoken must have %%. syntax correct.)

  1. in quicksearch.js uploaded via webdav js folder, edit following lines, around lines 184-195:

        if(all_results_count)     {         var tr = document.createelement('tr');         var td = document.createelement('td');         tr.classname = "quicksearchallresults";         tr.onmouseover = function() { quicksearch.over_all = true; };         tr.onmouseout = function() { quicksearch.over_all = false; };         td.colspan = 2;         td.innerhtml = $('viewmoreurl', response).text();         tr.appendchild(td);         popup.appendchild(tr);     } 

so this:

        if(all_results_count)         {             var tr = document.createelement('tr');             var td = document.createelement('td');             tr.classname = "quicksearchallresults";             tr.onmouseover = function() { quicksearch.over_all = true; };             tr.onmouseout = function() { quicksearch.over_all = false; };             td.colspan = 2;             td.innerhtml = 'your new custom text/name "view results" link goes here';             tr.appendchild(td);             popup.appendchild(tr);         } 

put new name of "view results" link in between ' , ' @ line starts td.innerhtml =

  1. now save , refresh page, , text changed natively, without having write js , watch events or delegate actions.

please let me know if helped or if have questions.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -