<div class="hh"><div class="ih" onclick="return koya.onEvent(arguments[0]||window.event,'3_2')"><div class="jh kh"></div></div></div>
Hello, I am working with a qml webview element and I want to remove a div from the loaded page . I use the function webView.evaluateJavascript() to run the javascript code. Now I googled very much and tried different JavaScript codes to remove the div, but I failed.
Can someone tell how to do this.
Assuming you have jquery loaded you can do something like this:
$(".ih").remove();
Where the . is followed by the class that exists on the div you want to remove.
If you don't have jquery loaded look into using getElementsByClassName
var child = document.getElementsByClassName('ih')[0];
child.parent.removeChild(child);
Related
I am curretnly working with some html, css and JS stuff and I am run into a problem. I have absolutly no idea why but I can' t access element in javascript using getElementById or jquery tag.. anything...
Here is html code of my element:
<div id="activeTickets" class="cardmenu_ActiveTickets">
<div id="txt_ActiveTickets" class="Title FontLightGreen">Active tickets:</div>
</div>
here is JS code :
alert($("#txt_ActiveTickets"));
alert(document.getElementById("txt_ActiveTickets"));
if(document.getElementById("txt_ActiveTickets")!= undefined){
document.getElementById('txt_ActiveTickets').innerHTML = Model.GetTranslateText();
}
this is happeing in JS function with name onTranslate() which is called here :
$( document ).ready(function() {
InitVariables();
ShowForm();
onTranslate();
});
In the function there are ten other divs set with the same code, only with different id, and all other divs works except for this one.. I absolutly have no idea what' s wrong.
I am sorry I can't really tell how exactly the html works with c++. It's project in my work. My colleague is making a c++ part of program and I am making the html,css,javascript stuff. As far as I know it's only connected by html5viewer object and each html page has it's model which is set for the every page and in the JS script then to access c++ function you just use Model.function(). That's should be the only connection to html. It only create html5viewer which displays the pages in html.
Isn't div id must be div id="activeTickets" ? Because by using div id="txt_ActiveTickets", you got the div id for question, not the answer. Also you can use another div id for answer. Try this.
I have a menu in Wordpress and I want to hook up Appointlet script to it. The code is here:
(function(e,t,n,r)
{
if(e)return;
t._appt=true;
var i=n.createElement(r),s=n.getElementsByTagName(r)[0];
i.async=true;i.src='//dje0x8zlxc38k.cloudfront.net/loaders/s-min.js';
s.parentNode.insertBefore(i,s)
})
(window._appt,window,document,"script")
<div data-appointlet="tfracine">
</div>
My idea is to create menu item with blank name, get its id (for example, "#menu-item-66"). Then add my code in front of it using jQuery function.prepend().
So I created custom js file, included it in the header.php file and the code inside the file was this:
$(document).ready(function(){
$( "#menu-item-66" ).prepend( "Test" );
});
I started with the word "Test" to figure out if it works.
Unfortunately, nothing happened and I have lack of skills to figure out why. Any suggestions or smarter way to do it?
The jQuery .prepend() function will prepend a jQuery element, not a string.
So, you have to create a jQuery element by doing:
var newElement = $('<p>New Element</p>');
In your case, what you could do is:
$(document).ready(function(){
$('#menu-item-66').prepend($('<p>This is a jQuery element</p>');
});
For a complete reference, check the .prepend() documentation out.
.prepend() and .prependTo() adds the specified content as the first child.
The question is bit not clear. Do you want to insert your script inside your
div ?
Here is what I have in my member.php for my fancybox:
<script type="text/javascript">
$(document).ready(function()
{
$("a#uploadpage").fancybox({
'titleShow' : false
});
});
</script>
.
.
.
<a id="uploadpage" href='uploadpage.php'>Change Image</a> <br/>
This works perfectly, and by perfectly I mean it opens the fancybox containing the php code in uploadpage.php. Once the user pushes the submit button in uploadpage.php to upload there image I want it to either display an error message(invalid file type or file size too big), or a progressbar if the image is a valid file type and below 1MB. How do I do this within the SAME FANCYBOX? (I have the code for the error messages and progressbar already so I just need to know how to either refresh the fancybox or how to use javascript to accomplish this.)
Thanks a lot, I greatly appreciate it.
-Matt
I don't know if this will work, I've never used fancybox the way you are trying to use it, but, here's my suggestion: you could try using a class name instead of an ID. The anchor would be <a class="uploadpage" ...> instead of the id you use now. Also, change
$("a#uploadpage").fancybox({
to
$("a.uploadpage").fancybox({
fancybox makes a new instance of the box for each invokation when using id. It tries to reuse it if you use class names instead. Also, could try marking with a rel="myuploadbox", i.e.
<a rel="myuploadbox" class="uploadpage" ...>
Fancybox uses the rel attribute to group related things together, this might keep it from closing the box on your submit. Also, wrap everything you want inside that same fancybox in a div tag with the same rel attribute (I don't know if it would be supported that way by fancybox.. give it a try).
i need a code in Jquery for hide all images on all pages except the 'reCaptcha' thing.
The images of reCaptcha start with the link: 'google.com/recaptcha' or 'recaptcha.net' ...
My idea is to make the script that hide all images but not touch the images that contains the part 'recaptcha'.
Is possible to make in Jquery?
Thanks in advance and to all.
Kind Regards.
Luca.
Something like this?
$('img:not([src*=recaptcha])').hide();
First run $("img").hide(); then simply put an ID on the captcha tag and run $("#ID").show();
Or if you can't use an ID tag, cycle through all images in a loop and check what's in the src attribute, or even use a regex selector.
The ReCaptcha script puts all of its generated markup within a <div id="recaptcha_widget_div">
Having said that, you can grab all images except those within this DIV like this...
$("img:not(#recaptcha_widget_div img)").hide();
Or if that is too ugly, you can hide all images and re-show the ReCaptcha ones like this...
$("img").hide();
$("#recaptcha_widget_div img").show();
I am busy writing a simple Adobe Air app using HTML, jQuery and some jQuery plugin to load RSS feeds.
The problem I am having is that I am generating a section of HTML components (buttons) so that I can execute specific code on button click. But when the page is displayed the button never executes; I have tried using the built-in log function as well as alert, but none of them execute. The weird part is when I copy the HTML component into a part of the page that is not generated it executes fine.
I insert the following into a div using jQuery and it does not execute.
'<input type="button" onclick="LoadPage()" value="Test" />'
If I just insert it into the HTML it works fine.
I am using version 1.3.2 of jQuery; I am also using this plugin to load the data into a div, and I have modified line 82 to include the html component above.
I should note that when I inspect the page using AIR's introspector the HTML is valid.
What could be going wrong?
I don't see the problem. The following works fine for me:
$(document).ready(function() {
$('#mainDiv').html('<input type="button" onclick="LoadPage()" value="Test" />');
});
function LoadPage()
{
alert("Hello");
}
If you want to use jquery to handle the click you can use the live event.
I also had that problem some time ago, and this solved the problem.
If you give your button an id would look something like this:
$("#YourButtonId").live("click", function (){....
Got the same problem with 'onClick' instead of 'onclick' ?
Also check if the function isn't called 'Loadpage' instead of 'LoadPage'.
I sometimes have case sensitive problems in javascript, not sure if it are functions that are case sensitive.