Forums

search vs. clear button

admin_wiky 29 Mar, 2016
hello,

I have a problem with CC.

I found out this code what clear search field
<input name="reset" id="reset" type="submit" value="VYMAZAT" class="" onClick="document.getElementById('search').value = '';"  style="float:right;height:32px;font-weight:bold;">


but I must modify code by adding a parameter ID
<input type="text" name="srch" id="search" placeholder="" class="form-control A"/>


and problem is when is id="search" in code then searching doesnt work .. when I remove this parameter then it works.

any idea how solve it?
GreyHead 29 Mar, 2016
Hi homeopat,

I've no idea why adding the id='search' causes a problem - what happens if you add e.g. id='xxx' does the search work then?

Otherwise you could modify the JavaScript to get the element by name.

Bob
admin_wiky 29 Mar, 2016
Hi Bob,

if I change id in search field then I must modify it in clear button (onClick="document.getElementById('search').value = '';")

.. so nothing happened - no search.

thank you
GreyHead 29 Mar, 2016
Hi homeopat,

I'm not clear what you've tested - you would need to change the id in both places?

Bob
This topic is locked and no more replies can be posted.