html() not updating until I scroll the page
I have a custom font, and a class that I put on a div that replaces any text in the div with the custom font icon...
This div is supposed to switch between a search icon and an x icon. Sometimes, the icon doesn't change until I nudge the page up or down... can't figure out why?
Here's the div:
- <a href="/search/" class="ficon" id="search-trigger">B</a>
and here's the jquery:
- jQuery(document).ready(function(){
- jQuery("#search-trigger").click(function(e){
- if(jQuery("#search-trigger").html() == "B"){
- jQuery("#search-trigger").html("G");
- }
- else{
- jQuery("#search-trigger").html("B");
- }
- jQuery("#search-wrapper").toggle();
- e.preventDefault();
- });
- });