我想你有这个
<a title="Date::04/08/2013" id='date-link'>
<span id="date-title" class="name">Date::</span>
<span id="date-value" data-value="04/08/2013" class="value">04/16/2013</span>
</a>
你想要跟随
<a title="Date::04/16/2013" id='date-link'>
<span id="date-title" class="name">Date::</span>
<span id="date-value" data-value="04/16/2013" class="value">04/16/2013</span>
</a>
如果是这样,您可以尝试以下
var dateTitle = jQuery("#date-title").html()
var dateValue = jQuery("#date-value").html()
jQuery('#date-link').attr('title', dateTitle+dateValue);
jQuery('#date-value').attr('data-value', dateValue);
您可以使用以下代码创建一个 html 文件并检查您自己的
<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script>
<a title="Date::04/08/2013" id='date-link'>
<span id="date-title" class="name">Date::</span>
<span id="date-value" data-value="04/08/2013" class="value">04/16/2013</span>
</a>
<a href ="javascript:void(0)" onclick="abc()">Click Here</a>
<script>
function abc() {
var dateTitle = jQuery("#date-title").html()
var dateValue = jQuery("#date-value").html()
jQuery('#date-link').attr('title', dateTitle+dateValue);
jQuery('#date-value').attr('data-value', dateValue);}
</script>