Is there a way to 'search n replace fill' HTML with jQuery?

Try it out: jsfiddle.net/WZ2Vk (Requires jQuery 1.4 or later) var newText = { text: "some new text", othertext: "some other new text" } $('div. Foo'). Text(function(i,txt) { var key = txt.

Match(/\{(^}+)\}/)1; return newTextkey; }) You didn't give the structure of the Array, but I assume you're using it in a manner better suited for an Object. In the example above, I used and Object instead of an Array. Will work just fine with an Array Same example but with an Array: jsfiddle.net/WZ2Vk/1 If you're replacing with actual HTML content, then change text() to html() jsfiddle.net/WZ2Vk/2.

Try it out: jsfiddle.net/WZ2Vk/ (Requires jQuery 1.4 or later) var newText = { text: "some new text", othertext: "some other new text" } $('div. Foo'). Text(function(i,txt) { var key = txt.

Match(/\{(^}+)\}/)1; return newTextkey; }); You didn't give the structure of the Array, but I assume you're using it in a manner better suited for an Object. In the example above, I used and Object instead of an Array. Will work just fine with an Array.

Same example but with an Array: jsfiddle.net/WZ2Vk/1/ If you're replacing with actual HTML content, then change .text() to .html(). jsfiddle.net/WZ2Vk/2.

Thanks! That totally did the trick. – Reinder de Vries Aug 26 '10 at 10:45.

I want to use the snippet above as a template (snippet resides in jQuery-able webpage) for the array. Array entry goes in, HTML comes out. Here's the tricky part: I want to replace {text} with the text key from the array entry.

And all with jQuery of course ;-).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions