my String is:
var str = "<footnote xml:id="ch03-fn-5" label="5"><para aid:pstyle="Copytext">„Muchacho“ (1924), Musik: Luis N. Visca, Text: Celedonio Esteban Flores.</para></footnote>"
I want to store the contents which is inside the footnote tag in another variable, I need a string function to slove this,
Note : the values of xml:id="ch03-fn-5" label="5"
may come as single digit or double digit.
Can someone give any Idea for this
Thank you!
jQuery can help:
$(str).html();
$(yourAnotherFoornotVar).find('para').html()
You can put a html string into the jQuery selector, without really having that element in your page.
do you mean like:
var str = '<footnote xml:id="ch03-fn-5" label="5"><para aid:pstyle="Copytext">„Muchacho“ (1924), Musik: Luis N. Visca, Text: Celedonio Esteban Flores.</para></footnote>';
var match,
res = "",
pattern = /<footnote[^>]*>(.*?)<\/footnote>/ig;
while (match = pattern.exec(str)) {
res += match[1];
}
console.log(res); //<para aid:pstyle="Copytext">„Muchacho“ (1924), Musik: Luis N. Visca, Text: Celedonio Esteban Flores.</para>
Demo:: jsFiddle
newStr will hold whatever is in inside footernote, no need of jQuery for this.
var str = '<footnote xml:id="ch03-fn-5" label="5"><para aid:pstyle="Copytext">„Muchacho“ (1924), Musik: Luis N. Visca, Text: Celedonio Esteban Flores.</para></footnote>';
var newStr = str.substr(str.indexOf(' ')+1, (str.indexOf('>')-10));
console.log(newStr); // xml:id="ch03-fn-5" label="5"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.