Home > database >  add a class to font inside a div with a class using jquery
add a class to font inside a div with a class using jquery

Time:04-27

I have following html rendered in power portals and it is causing to break the formating of the input group.

<div >
    <div  role="none">
       <font size="3" style="position: relative;">
          <input name="ctl00$ContentContainer$WebFormControl_3596f2cdce74ec11894300224812"....>
       </font>
    </div>
<div>

I have tried adjusting in dev tools and if I found that if apply a class of "input-group" to the font attribute everything formats nicely if it is like below.

 <font size="3"  style="position: relative;"></font>

I am not sure how to find the font attribute in dom using jQuery. I have tried this below but it seems to not do anything

$(document).ready(function () {
$('#WebFormPanel').each(function(e) {
    let divinputgroup = $(this).find("input-group");
         if(divinputgroup.length){
            $("font").addClass("input-group");
         }
    })
 });

CodePudding user response:

   $(document).ready(function () {
$('#WebFormPanel').each(function(e) {
    let divinputgroup = $(this).find(".input-group");
         if(divinputgroup.length){
            $("font").addClass("input-group");
         }
      })
  });

You can use this and also you can give class to font, so that it can be use easily

  • Related