jquery: Blinking the button text makes the button jump
<p>Given:</p>

<p>html:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no" /&gt;
    &lt;style type="text/css"&gt;
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
    &lt;/style&gt;
    &lt;script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?key=bla-bla-bla&amp;sensor=false&amp;libraries=geometry"&gt;
    &lt;/script&gt;
    &lt;script type="text/javascript" src="jquery.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="sdr.js"&gt;&lt;/script&gt;
&lt;/head&gt;
  &lt;body&gt;
    &lt;div style="display: table; height: 100%; width: 100%;"&gt;
        &lt;div id="data" style="display: table-row; height: 20px;"&gt;
            &lt;div style="display: table-cell;"&gt;
                &lt;input id="btnPoint" type="button" value="Mark the point" onclick="markPoint()" /&gt;
                Point: &lt;input id="txtPoint" type="text" /&gt;&lt;br /&gt;
                &lt;input id="btnPolygon" type="button" value="Mark the polygon" /&gt;
                Polygon: &lt;input id="txtPolygon" type="text" /&gt;
             &lt;/div&gt;
        &lt;/div&gt;
        &lt;div style="display: table-row; "&gt;
            &lt;div id="map_canvas" style="display: table-cell;"&gt;&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>sdr.js:</p>

<pre><code>var map;
var pointMarker;

$(document).ready(initialize);

function initialize() {
    var chicago = new google.maps.LatLng(41.850033, -87.6500523);
    var myOptions = {
        zoom : 7,
        center : chicago,
        mapTypeId : google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map($('#map_canvas')[0], myOptions);
    pointMarker = new google.maps.Marker({
    position: map.getCenter()
    });

    $('#btnPoint').css('width', $('#btnPoint').outerWidth());
    $('#btnPoint').css('height', $('#btnPoint').outerHeight());
    $('#btnPoint').each(function () {
        var elem = $(this);
        var title = elem.val();
        setInterval(function () {
            if (!elem.val()) {
                elem.val(title);
            } else if (elem.data('listener')) {
                elem.val('');
            }
        }, 500);
    });
}

function placePointMarker(location) {
    pointMarker.setPosition(location);
    pointMarker.setTitle(location.lat() + "," + location.lng());
    pointMarker.setMap(map);
    var text = Math.round(location.lat() * 1000) / 1000 + ',' + Math.round(location.lng() * 1000) / 1000
    $('#txtPoint').val(text);
}

function markPoint() {
    var listener = $('#btnPoint').data('listener');
    if (listener) {
        google.maps.event.removeListener(listener);
        $('#btnPoint').removeData('listener');
    } else {
        $('#btnPoint').data('listener', google.maps.event.addListener(map, 'click', function(event) {
            placePointMarker(event.latLng);
        }));
    }
}
</code></pre>

<p>All I am trying to do is make the "Mark the point" button blink when clicked and stop blinking when clicked again. The problem is that it seems to change the position when I remove the button text and restore it back. It looks like the button jumps. I have no idea why. Anyone?</p>
