html - change font size for getElementsByClassName -


i scrap paragraph in page using getelementsbyclassname. however, unable change font size , color of output.

below code scrap.

var keypeople1 = tmp.body.getelementsbyclassname("cr_profile_people module")[0].children; (var = 0; < keypeople1.length; i++) {   keypeople1[i].style.fontsize = "2em"; } $scope.keypeople = "<div class='cr_profile_people module'><div class='mod_headerbox'>"+keypeople1[0].innerhtml+"</div><div class='cr_data cr_board'>"+keypeople1[1].innerhtml+"</div></div>"; 

the loop suppose change font size not work.

html snippet

<div style="margin: 10px;" ng-bind-html="keypeople"></div>

add fontsize in style <div style="margin: 10px;font-size:60%;"ng-bind-html="keypeople"></div> has no effect on font size.

please guide correct way change font size , color. enter image description here

full code

angular js scrap page

.controller("companyownershipctrl",function($scope,$http,$ionicloading,$state,$cashdatafactory){     $ionicloading.show();    $http.get("http://vinn.johnapi.com/wsjapi?url=http://quotes.wsj.com/sg/u11/company-people")   .success(function(response){     $ionicloading.hide();     var tmp = document.implementation.createhtmldocument();      tmp.body.innerhtml = response;      //company info     var companyinfo1 = tmp.body.getelementsbyclassname("cr_profile_contact")[0].children;     var companyinfo2 = tmp.body.getelementsbyclassname("cr_overview_data cr_data")[0].children;      $scope.companyinfo = "<div class='cr_profile_contact'>"+companyinfo1[0].innerhtml+"</div>";     $scope.companyinfo += "<div class='cr_overview_data cr_data'>"+companyinfo2[0].innerhtml+"</div>";      //description     var description1 = tmp.body.getelementsbyclassname("cr_description_full cr_expand")[0].children;     $scope.companydescription = "<p>"+description1[0].innerhtml+"</p>";      //key people     var keypeople1 = tmp.body.getelementsbyclassname("cr_profile_people module")[0].children;     $scope.keypeople = "<div class='cr_profile_people module'><div class='mod_headerbox'>"+keypeople1[0].innerhtml+"</div><div class='cr_data cr_board'>"+keypeople1[1].innerhtml+"</div></div>";      //average growth rates     var growth = tmp.body.getelementsbyclassname("cr_profile_growth module")[0].children;     var growth1 = tmp.body.getelementsbyclassname("cr_profile_insider module")[0].children;     $scope.averagegrowthrates = "<div class='cr_profile_growth module'><div class='mod_headerbox'>"+growth[0].innerhtml+"</div><div class='cr_data'>"+growth[1].innerhtml+"</div></div>";     $scope.averagegrowthrates += "<div class='cr_profile_insider module'><div class='mod_headerbox'>"+growth1[0].innerhtml+"</div><div class='cr_data'>"+growth1[1].innerhtml+"</div><div class='cr_data'>"+growth1[2].innerhtml+"</div></div>";      //ownership     var ownership = tmp.body.getelementsbyclassname("cr_profile_ownership module")[0].children;     $scope.averagegrowthrates += "<div class='cr_profile_ownership module'><div class='mod_headerbox'>"+ownership[0].innerhtml+"</div><div class='cr_data'>"+ownership[1].innerhtml+"</div><div class='cr_data'>"+ownership[2].innerhtml+"</div></div>";   }).error(function(error){      $ionicloading.hide();     console.log(error.data);    }); 

html

<ion-view view-title="company">   <ion-nav-buttons side="left">   </ion-nav-buttons> <ion-content id="comp">   <ion-scroll>     <h3 style="margin: 10px;">company info</h3>     <div style="margin: 10px;" ng-bind-html="companyinfo"></div>     <h3 style="margin: 10px;">description</h3>     <div style="margin: 10px;font-size:20px;" ng-bind-html="companydescription"></div>     <div style="margin: 10px;color:#aaafff;font-size:40px;" ng-bind-html="keypeople"></div>s        <div style="margin: 10px;" ng-bind-html="averagegrowthrates"></div>     <div style="margin: 10px;" ng-bind-html="ownership"></div>   </ion-scroll> </ion-content> </ion-view> 

updated: current answers @manzurul , @varun sukheja.

  1. the font size , color inside red box draw ,both not take effect

  2. font size of table below red box not take effect, color changed.

thus, curious why font size inside red box unable changed? more important how changed it.

the picture using

.controller("companyownershipctrl",function($scope,$http,$ionicloading,$state,$cashdatafactory){  $scope.companydescriptionstyle = {"color": "blue", "font-size": "40px"};  

in angularjs , <div style="margin: 10px;font-size:20px;" ng-bind-html="companydescription" ng-style="companydescriptionstyle"></div> in html, can notice font size same above.

enter image description here

the html code scrapped link http://quotes.wsj.com/sg/u11/company-people

<div class="cr_profile_people module"> <div class="mod_headerbox"> <h3>key people <span class="hdr_co_name">united overseas bank ltd.</span></h3> </div> <div class="cr_data cr_board"> <h4>board of directors</h4> <table class="cr_datatable cr_board_table"> <tbody> <tr> <th>name/title</th> <th>current board membership</th> </tr> </tbody> </table> <div class="scrollbox"> <table class="cr_datatable cr_board_table"> <tbody> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86291589">ee cheong wee</a>, <span class="data_meta">63</span> </span> <span class="data_lbl">deputy chairman &amp; chief executive officer</span> </td> <td> <span class="data_lbl">pt bank uob indonesia, visa international senior client council, united overseas bank ltd., singapore-china foundation ltd., far eastern bank ltd., united overseas insurance ltd., united overseas bank (thai) public co. ltd., united overseas bank (malaysia) bhd., institute of banking &amp; finance, united overseas bank (china) ltd., wee foundation, united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/16055509">michael lien</a>, <span class="data_meta"></span> </span> <span class="data_lbl">non-executive director</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/104206">cho yaw wee</a>, <span class="data_meta">88</span> </span> <span class="data_lbl">chairman-emeritus</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/16489539">fu hua hsieh</a>, <span class="data_meta">66</span> </span> <span class="data_lbl">chairman</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86320739">khirn hai yeo</a>, <span class="data_meta">55</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/154674047">kan seng wong</a>, <span class="data_meta">71</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/13470908">alexander charles hungate</a>, <span class="data_meta">51</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/98308786">hwee hua lim</a>, <span class="data_meta">57</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore), bw group ltd., jardine cycle &amp; carriage ltd., stewardship &amp; corporate governance centre pte ltd., pap community foundation, stewardship asia centre pte ltd.</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/104667">cher siang koh</a>, <span class="data_meta">70</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">singapore housing &amp; development board, united overseas bank ltd., capitaland ltd., united overseas bank ltd. (singapore), thye hua kwan moral charities ltd., mechanobiology institute, singapore golf association, singapore cooperation enterprise, capitaland hope foundation, singapore deposit insurance corp., singapore island country club</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/114522422">yew huat ong</a>, <span class="data_meta">60</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">united overseas bank ltd. (singapore)</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86318967">jue hiang cheng</a>, <span class="data_meta">62</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">sph mediaboxoffice pte ltd., sph interactive pte ltd., feo hospitality trust management pte ltd., far east hospitality trust, feo hospitality asset management pte ltd., sph interactive international pte ltd., singapore institute of directors, 701search pte ltd., ntuc fairprice foundation ltd., ashoka innovators public (singapore) ltd., united overseas bank ltd. (singapore), council third age ltd., integrated information systems, inc., aescapulus holdings pte ltd., singapore health services pte ltd., integrated health information systems pte ltd., symasia foundation ltd., asia philantrophic ventures pte ltd., asia philanthropic ventures pte ltd., caritas humanitarian aid &amp; relief initiatives, singapore</span> </td> </tr> <tr> <td> <span class="data_data"> <a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/41491049">franklin leo lavin</a>, <span class="data_meta">58</span> </span> <span class="data_lbl">independent non-executive director</span> </td> <td> <span class="data_lbl">far eastern bank ltd., globe specialty metals, inc., consistel (singapore) pte ltd., united overseas bank ltd. (singapore), united overseas bank ltd., export now, inc.</span> </td> </tr> </tbody> </table> </div> <div class="bottomstrap_more"> <a href="#" id class="morelink loadmorelink">expand</a> </div> </div> <div class="cr_data cr_all_executives"> <h4>all executives</h4> <div class="scrollbox"> <ul class="cr_data_collection cr_all_executives"> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86291589">ee cheong wee</a></span> <span class="data_lbl">deputy chairman &amp; chief executive officer</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86291593">wai cheng hwee</a></span> <span class="data_lbl">head-group technology &amp; operations</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86291587">wai fai lee</a></span> <span class="data_lbl">chief financial officer</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/4815192">victor ngo</a></span> <span class="data_lbl">head-group compliance</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/122181365">see-ming ip yeung</a></span> <span class="data_lbl">managing director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/122099381">chin voon-fat</a></span> <span class="data_lbl">head-group wholesale banking</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/120136914">kok seong chan</a></span> <span class="data_lbl">group chief risk officer</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/115461061">wah yan wong</a></span> <span class="data_lbl">head-group strategy &amp; international management</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/160726">terence ong</a></span> <span class="data_lbl">head-global markets &amp; investment management</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86328526">chin yong lee</a></span> <span class="data_lbl">head-group retail</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/16055509">michael lien</a></span> <span class="data_lbl">non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/104206">cho yaw wee</a></span> <span class="data_lbl">chairman-emeritus</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/152463410">carrie ann mathews</a></span> <span class="data_lbl">head-group strategic communications</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/120300850">shih tung lin</a></span> <span class="data_lbl">investor relations contact</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/95901534">mei leng wong</a></span> <span class="data_lbl">head-group human resources</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/138452461">ming kuang sia</a></span> <span class="data_lbl">co-secretary</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/151489730">kwee soik sim</a></span> <span class="data_lbl">co-secretary</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/16489539">fu hua hsieh</a></span> <span class="data_lbl">chairman</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86320739">khirn hai yeo</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/154674047">kan seng wong</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/13470908">alexander charles hungate</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/98308786">hwee hua lim</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/104667">cher siang koh</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/114522422">yew huat ong</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/86318967">jue hiang cheng</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> <li> <div class="cr_data_field"> <span class="data_data"><a href="http://quotes.wsj.com/sg/xses/u11/company-people/executive-profile/41491049">franklin leo lavin</a></span> <span class="data_lbl">independent non-executive director</span> </div> </li> </ul> </div> <div class="bottomstrap_more"> <a href="#" id class="morelink loadmorelink">expand</a> </div> </div> </div> </div> <!--data-module-name="quotes.module.companypeople.module"--> <div intent in-at8units-append="#at8utarget" in-at12units-append="#at12utarget" in-at16units-append="#at12utarget"> <div data-module-id="12" data-module-name="quotes.module.ads.responsivead" data-module-zone="ads" class="zonedmodule"> <div class="boxadwrapper module" id="main-quotes-ad"> <span class="adtitle">advertisement</span> <div class="quotes-ad-wrap" id="ad_g" data-ad-options="{&quot;adid&quot;:&quot;ad_g&quot;,&quot;adunitpath&quot;:&quot;/2/asia.wsj.com/quotes_front&quot;,&quot;adsize&quot;:[[300,250],[300,1050]],&quot;adsizemap&quot;:null,&quot;autorefresh&quot;:false,&quot;adtargeting&quot;:{&quot;metazone&quot;:&quot;&quot;,&quot;msrc&quot;:null,&quot;circ&quot;:&quot;nonsub&quot;,&quot;sym&quot;:&quot;u11&quot;,&quot;p39&quot;:null}}" data-tracking="asia.wsj.com/quotes_front" data-cb-ad-id="toprectangle"> </div> </div> </div> 

how css solution problem

.cr_profile_people.module > .mod_headerbox > h3 {     font-size: 10px!important; }  .cr_profile_people.module .cr_datatable.cr_board_table > tbody > tr > th {     font-size: 40px!important; } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -