function boldWord(name,num){
var x=jQuery(name).text();
var splitx=x.split(" ");
var new1="";
var old="";
for(var y=0; y<num;y++){
old+=splitx[y]+" ";
new1+="<b>"+splitx[y]+"</b> ";
}
var finalCont=jQuery(name).html().replace(old,new1);
jQuery(name).html(finalCont);
}
boldWord("class or id",3)
No comments:
Post a Comment