JavaScript Changing style inside jquery selector dynamically change style inside iframe,change style inside div,change style

I have a div and I am trying to display a text with bold font as follows:

$('#div').text("data between "+ fromdate + "to" + todate).css({'text-align':'centre'});

How do I display only "fromdate" and "todate" in bold font?

Answer:1

Use .html(), and wrap the text in <b> (if it is presentational) or <strong> tags:

$('#div')
    .html("data between <b>" + fromdate + "</b> to <b>" + todate + "</b>")
    .css("text-align", "center");

And centre should be center.

Answer:2

set as html then assign and filter as class, finally set the css to the filtered result

$('#div').html("data between <span class='bold'>"+ fromdate + "</span>to<span class='bold'>" + todate + "</span>").css({'text-align':'center'}).filter( ".bold" ).css( "font-weight", "bold" );
Answer:3

I have a HTML structure like this: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <table id ="x"> <tr> <td class='col1'> ...

I have a HTML structure like this: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <table id ="x"> <tr> <td class='col1'> ...

I have a form in which certain calculations are happening as per the dropdown selected. Everything is working fine except that when i select a value from dropdown price/unit field has to be filled by ...

I have a form in which certain calculations are happening as per the dropdown selected. Everything is working fine except that when i select a value from dropdown price/unit field has to be filled by ...

sorry but I'm new in javascrit. I'm writing a simple rss reader, but I want to limit the number of feeds to 5 items, because the my target site can have 100 or more. Here the code: $("#mainPage")....

sorry but I'm new in javascrit. I'm writing a simple rss reader, but I want to limit the number of feeds to 5 items, because the my target site can have 100 or more. Here the code: $("#mainPage")....

  1. javascript limit number of characters
  2. javascript limit number of decimals
  3. javascript limit number range
  4. javascript limit number to 2 decimal places
  5. javascript limit number of checkboxes selected
  6. javascript limit number of words
  7. javascript limit number to 1 decimal place
  8. javascript limit number of characters in textbox
  9. javascript limit number of characters in input
  10. javascript limit number
  11. javascript limit number of decimal places
  12. javascript limit number input
  13. javascript limit number length
  14. javascript limit number of digits
  15. javascript limit number of lines in div
  16. javascript limit number to 2 decimals
  17. javascript limit number of lines in textarea
  18. javascript limit number of characters in div
  19. javascript limit number of events
  20. javascript limit number of characters in textarea

Demo link <input type="date" class="datepicker"> $('.datepicker').pickadate({ selectMonths: true, // Creates a dropdown to control month selectYears: 15 // Creates a ...

Demo link <input type="date" class="datepicker"> $('.datepicker').pickadate({ selectMonths: true, // Creates a dropdown to control month selectYears: 15 // Creates a ...