update the part of HTML text inside DIV using Jquery -
<div class="test"> name - date //first name ,last name - 7/24/2013 <button type="button"/>
how update part of html text inside div using jquery.
i need update date section alone inside div. tried having date section in span class name
, update text.
but there must way update text without having <span>
.
am looking fix without using
thanks
i suggest bit of different way, using regular expression. (although best way use span element.)
var testpattern = /date/; var divtotest = $('.test').html(); divtotest = divtotest.replace(divtotest.match(testpattern),'yourdate'); $('.test').html(divtotest);
also keep in mind, if date example dd.mm.yyyy format , need change reg exp specific format. hope helped :). (edited: @geoff appleford)
Comments
Post a Comment