Reputation: 77
Here is my java script code:
function for_approve(){
var approve = confirm(format_stock_id.length +
" Stock Record(s) is selected for approval.<br />
Do You Want to send it for Approval");
}
It gives me result as:
3 Stock Record(s) is selected for approval.<br />Do You Want to send it for Approval
What should i do for space and new line.
Upvotes: 0
Views: 4371
Reputation: 7269
Use the \n
symbol:
function for_approve(){
var approve = confirm(format_stock_id.length +
" Stock Record(s) is selected for approval.\n
Do You Want to send it for Approval");
}
You can check this right here. Open console in your browser and write: alert("bob\nbob");
EXAMPLE
Command:
Result:
P.S.: Same for space. You don't have to use escape-query
. Just use
(simple space).
Upvotes: 3
Reputation: 631
use:
\xa0
space
\n
new line
your code will be:
function for_approve(){
var approve = confirm(format_stock_id.length + "\xa0 Stock Record(s) is selected for approval.\n Do You Want to send it for Approval");
}
Upvotes: 0
Reputation: 16953
If you wanted to make the sentence a little neater with regard to plurals, you could do this:
if (format_stock_id.length == 1) {
var approve = confirm("1 Stock Record is selected for approval.\n
Do You Want to send it for Approval");
} else {
var approve = confirm(format_stock_id.length + " Stock Records are selected for approval.\n
Do You Want to send them for Approval");
}
Little things like that make a good amount of difference in the final product.
Upvotes: 1
Reputation: 2518
You can use the JS Escape Characters in a string (ref: http://www.w3schools.com/js/default.asp) :
\' single quote
\" double quote
\\ backslash
\n new line
\r carriage return
\t tab
\b backspace
\f form feed
Upvotes: 0
Reputation:
To jump to next line you need to use \n and for space no need to to write  , simply write whitespace character,
function for_approve(){ var approve = confirm(format_stock_id.length + " Stock Record(s) is selected for approval.\n Do You Want to send it for Approval"); }
Upvotes: 0