简体   繁体   中英

Removing a div class with Javascript or jQuery on page load

Unsure if anybody is familiar with TypeForm. I am currently testing their forms but its very limited to options with regards to optional items such as incremental question numbers, bullet points & * for required questions.. Ive attached a screenshot of the exact item shown in the dev window that I wish to remove, how is this possible on page load using Javascript or jQuery? ie document.getElementsByClassName("Item");

EDIT The way typeform is embedded is as shown in the snippet below:

Much appreciated !! 谷歌浏览器开发人员视图中要删除的项目

 <div class="typeform-widget" data-url="https://12837r8yhe.typeform.com/to/sKcd9C" style="width: 100%; height: 500px;" > </div> <script> (function() { var qs,js,q,s,d=document, gi=d.getElementById, ce=d.createElement, gt=d.getElementsByTagName, id="typef_orm", b="https://embed.typeform.com/"; if(!gi.call(d,id)) { js=ce.call(d,"script"); js.id=id; js.src=b+"embed.js"; q=gt.call(d,"script")[0]; q.parentNode.insertBefore(js,q) } })() </script> 

On page load you can do this to remove all instances of the class

$(document).ready(function(){
  $('.Item').remove('Item');
});

Or just the class on divs

$(document).ready(function(){
  $('div .Item').remove('Item');
});

$("div.item").remove() should do the trick as long as there arent other divs with the item class..

 $('div.item').remove(); 

or

 $('div.item').first().remove(); 

You can remove or hide it using jquery when the page loads. But it will remove all the div items which have class .item

 $(document).ready(function(){ $("div.item").remove(); console.log("removed"); }) 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <p>Div item was here but removed when page loaded.</p> <div class="item">1 ></div><span>Just before me</span> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM