Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery - change content of html <b> tag

I have set of frames and html pages . I have selected one of the frames html element from another html page and I want to change the content using jquery.

Here , I want to change "test.com" to "something.com" . Please let me know , how to achieve this.

HTML element in frame 0 :

<span class="topmid-left">Connected to <b>My Site 'test.com' </b> </span>

The same element can be selectable by jquery by setting context :

**query -**  $("b",window.frames[0].document)

**result -** <b>​My Site 'test.com' ​</b>​

How to change the content of tag here.

Thanks.

like image 887
JavaUser Avatar asked Sep 02 '25 02:09

JavaUser


2 Answers

Here is the fiddle: https://jsfiddle.net/swaprks/L1rq4o7a/

Use jquery and add the following to your javascript:

$(".topmid-left b").html("My Site 'something.com'");
like image 159
Swaprks Avatar answered Sep 04 '25 15:09

Swaprks


try this:

<script>
var str = 'your text';
$( "b" ).html( str );
or 
$("b").text(YOUR_TEXT)
</script>

Learn More

like image 24
Amitesh Kumar Avatar answered Sep 04 '25 17:09

Amitesh Kumar