How to change specific data of dialog box using js. | Community
Skip to main content
Level 3
Apr 9, 2021 5:33 AM UTC
Solved

How to change specific data of dialog box using js.

In my dialog I want to change specific content like in my dialog I have written "Search result for {{currentPage}}". Now I want to change only content of {{currentPage}} using js. How can that be done?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Apr 9, 2021 5:42 AM UTC

Hi @shagunmalik 

Using jquery you can do something like below:

 

<div class="something">Search result for {{currentPage}}</div>
var replaceString = $(".something").text();
var text = replaceString.replace("{{currentPage}}", "whatever text");
$(".something").text(text);

 

Thanks! 

4 replies

Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Apr 9, 2021 5:42 AM UTC

Hi @shagunmalik 

Using jquery you can do something like below:

 

<div class="something">Search result for {{currentPage}}</div>
var replaceString = $(".something").text();
var text = replaceString.replace("{{currentPage}}", "whatever text");
$(".something").text(text);

 

Thanks! 

Translate
Level 3
Apr 9, 2021 5:56 AM UTC
Hi @asutosh_jena_, can we doo it using id?
Translate