HTMLElement の組み込みアクセサーを使用します。
getAttribute(attributeName)
setAttribute(attributeName,newValue);
このような:
var yourElement = document.getElementById("chaticon");
var dataVal = yourElement.getAttribute("data-content");
var newData = "new data";
yourElement.setAttribute("data-content",newData);
ここに簡単なデモがあります: http://jsfiddle.net/hpfk3/
編集
ボタン要素について質問するだけでなく、おそらく jquery と popover を質問に含めるべきでした。これらは利用可能であるため、次のようにコンテンツを変更できます。
//store chat icon jQuery object
var chatIcon = $("#chaticon");
//change data attribute on element
//change jquery data object content
//call setcontent method
chatIcon.attr("data-content","new data").data('popover').setContent();
//target the popover element and restore its placement definition
chatIcon.data('popover').$tip.addClass(chatIcon.data('popover').options.placement);