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

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -