Hi folks,
I want to bind an event to a certain class and ID for when matching objects are created in the DOM.
I am doing this as I have some jQuery code in an ASP UpdatePanel, which causes the DOM to be re-loaded on its partial postback. I have reset the events with live(), however I need to call a 2 line initialisation function as soo...
I'm having the weird problem that after having javascript inject some dom-elements the css-rules defined for those elements are not obeyed in IE7(i.e: styling for these elements doesn't happen). (firefox and chrome work fine, others not tested)
Things I tried:
- cleared the cache
- no other css-rule takes precedence (no 'more-specific...
I have jQuery to select all font elements that are children of the element with id="right" within the html stored in the var html... when I do an alert to see how many elements it gets:
alert($("#right > font", html).length);
it gives me an alert of: 5
but when I try any of the following, I don't get any alerts...
alert($("#right > ...
Hi all,
I am trying to do a fancy blur/fade effect (which means i need 2 images) but I only want to load 1 in the HTML (in case js is not active) and add the other filename via jQuery (copying and renaming the file/src)
The pure html is along the lines of:
<div id="work">
<div>
<img src="css/images/abc1.jpg" width="360" height="227...
I have a table in my markup on which I want to add some divs before and efter like this:
<div class="widebox">
<div class="widebox-header">Opret/rediger bruger</div>
<div class="widebox-middle">
<table id="Table3"></table>
</div>
<div class="widebox-bottom"></div>
</div>
I'm trying to do this with jQuery, like this:
$('#Table3').befo...
Hi,
If I have a string that contains the html from a page I just got returned from an HTTP Post, how can I turn that into something that will let me easily traverse the DOM?
I figured HtmlDocument object would make sense, but it has no constructor. Are there any types that allow for easy management of HTML DOM?
Thanks,
Matt
...
Ok, I'm rewriting some vanilla JS functions in my current project, and I'm at a point where there's a lot of HTML being generated for tooltips etc.
My question is, is it better/preferred to do this:
var html = '<div><span>Some More Stuff</span></div>';
if (someCondition) {
html += '<div>Some Conditional Content</div>';
}
$('#parent...
I thought I had seen this in the first announcement of jQuery 1.4, but can't seem to find anything now.
I have a calendar table which is built dynamically from a json ajax response.
The table is built in a variable called putHtml.
Currently, once the table is added to the DOM, I run a showEvents function which takes each event and add...
I would like to show in dialog all elements with specific class. The dialog should hide the rest of the page. So for example:
On this SO page I want to show all elements with class="user-info". Those elements would be shown in dialog with same width and height and same css and everything else would be hidden. It would be like cutting th...
After submitting an iFrame, content with AJAX enabled functions is returned and everything works.
Once I move the content out from the iFrame to the main page through DOM manipulation and remove the iFrame, AJAX stops working.
How can I make it work?
I grab the body content of the iFrame and move it to an outside element through .inne...
Hello, I have the following HTML
<div class="goto_step3">
<a href="<?= $this->sitePfx ?>/cart/paypal/" id="js_checkout_now" class="arrow">Checkout & Pay</a>
<? if($this->discountCodeErrorMessage): ?>
<p class="error discountError"><?= $this->discountCodeErrorMessage ?></p>
<? endif; ?>
<div class="discountCode fncFixedHeight <?=...
Currently I have this JQuery script
var img = $(this);
img.wrap('<div class="photo"></div>');
img.parent().append("<p>" + img.attr("alt") + "</p>");
which successfully turns the following:
<img src="photo.jpg" alt="caption">
into this
<div class="photo">
<img src="photos.jpg" alt="caption"/>
<p>caption</p>
</div...
$('.testimonials blockquote p')
.prepend('<span class="quo ldquo">“</span>')
.append('<span class="quo rdquo">”</span>');
...prepends and appends TWICE. How do I prepend ldquo + whatever content inside the p + rdquo?
Thanks!
...
Hi all,
I understand you can add insert blocks of html before and after a target using before(), insertBefore(), after() and insertAfter().
I tried to do something similar to this
<script type="text/javascript">
$(document).ready(function(){
$("p").before("<div class='myContainer'>");
$("p").after("</div>");
})...
Hi,
I'm doing some form error handling/manipulation and I have the need to remove an error div that is before the input that is being validated...
HTML:
I'd like to remove the div.textError if the input field is validated. I tried this...
$(this).before('<div class="textError"></div>').remove('<div class="textError"></div>');
an...
Hi There, I have some ajax on my web page, that is triggered via a click event, the javascript in question looks like this,
$('.career_select .selectitems').click(function(){
var selectedCareer = $(this).attr('id');
$.ajax({
type: 'POST',
url: '/roadmap/step_two',
data: 'career_choic...
I make a $.get call to my db and it returns some HTML (data):
$.get(url, null, function(data) {
The HTML it returns is something like this:
<div id="1234" class="myclass">..more html..</div>
In my callback function, I try to add a class to it (based on some conditionals that I have tested are successfully being reached) like so:
i...
Is there a way to prevent programs like Firebug from manipulating the DOM of a page.
I've noticed that you can simply delete thing like ads that are paid for by other companies.
Is there a way for the page to stop it?
...
Hello! How can you get:
<a href="page.html" class="class1 class2" id="thisid">Text</a>
changed to
<p href="page.html" class="class1 class2" id="thisid">Text</p>
I'm familiar with jQuery's replaceWith but that doesn't keep attributes/content as far as I know.
Note: Why would p have a href? Cuz I need to change p back to a on a...
Ok, so i have a few <div1> elements with static content inside of them. Then if you hover over the <div1> another <div2> pops up over top of it. (note: how this happens is the "display" property changes from "none" to "block") This <div2> has data that is relevant to <div1>. It populates dynamically based on the <div1> that you over o...