Reputation: 99
Here's a strip of my code:
$("#body").val("Dear Supplier,\n\nWe would like to cancel our order of
[product specifications] made on [date of order submission].
Please send us a reply to provide confirmation at earliest convenience.
\nThank you.\n\nYours sincerely,\n...");
Is there any way of making the "[product specifications]" part bold? I tried surrounding it inside the <b></b>
tags but that didn't work.
EDIT: My #body field is a text area.
Upvotes: 2
Views: 351
Reputation: 7277
Is there any way of making the "[product specifications]" part bold? I tried surrounding it inside the tags but that didn't work.
No, it's not possible with <textarea>
.
You have to resort to a WYSIWYG editor.
Upvotes: 4
Reputation: 1106
The .val()
allows you to change the value of your cibling element. Olr, what you need is to insert code / or replace the existing one with HTML tags. SO if you just use the .html()
function in jQuery it should fit your needs. Here how to do :
$("#body").html("<b>D</b>ear Supplier,\n\nWe would like to cancel our order of
[product specifications] made on [date of order submission].
Please send us a reply to provide confirmation at earliest convenience.
\nThank you.\n\nYours sincerely,\n...");
Upvotes: -1
Reputation: 44
$("#body").html("Dear Supplier,\n\nWe would like to cancel our order of \ [product specifications] made on [date of order submission]. \ Please send us a reply to provide confirmation at earliest convenience. \ \nThank you.\n\nYours sincerely,\n...");
Upvotes: -1
Reputation: 228
Maybe you could use a div
with contenteditable="true"
instead: $('div#body').html(yourText).
This is if you still want bold phrases in an element but want to maintain the input feature.
Upvotes: 0