Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to change specific data of dialog box using js.

Avatar

Level 3

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?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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! 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

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! 

Avatar

Community Advisor

@ShagunMalik Yes you can do using either Id or Class.

 

<div id="something">Search result for {{currentPage}}</div>

 

var replaceString = $("#something").text();
var text = replaceString.replace("{{currentPage}}", "whatever text");
$("#something").text(text);