I have an HTML demo page, whichs contain a placeholder “||client||”. It’s used throughout the page for example:
<img src="images/||_client_||/img1.jpg" />
or
<title>||_client_|| Demo</title>
and so on.
I want to globally replace the palceholder with the respective client ID once the page loads. The page is just for demo-purposes so I don’t want to set up anything server side.
I’m binding to this:
$('div:jqmData(role="page")').on('pagebeforecreate', function() {
// replace ||_client_|| with some ID
});
Question:
Is there a Jquery method to run through the DOM and find all instances of my placeholder and replace them or do I have to do each one by hand and look for all img tags, check the src for substring and replace this substring? There must be a nicer way?
Thanks for help!
Why do you need jQuery?
For the entire page:
As a word of caution, make sure you do this after the page is ready (so that the body has all the elements), and before you bind events to any elements.