So, sometimes, my output will look like this:
<p><img src="someimage.jpg" /></p>
<p>A new paragraph</p>
Other times, it will look like this:
<img src="someimage.jpg />
<p>A new paragraph</p>
I'm trying to write some sort of "if" statement where, if the first p element in the markup surrounds an image tag, it will pull:
$j("p:eq(1)...
$("br").parent().contents().each(function(i) {
if(this.nodeType == "#Text")
{
alert(this.textContent);
}
});
i am trying to select all texts not surrounded by html tags, but separated via <br>
doing this, sometimes returns a lot of alert messages, even when there should only be a couple.
i have tried to filter it ...
I'm nearly where I want to be, except that I can't figure out how to turn var imgt into a hyperlinked image. I've tried some things, but it keeps returning [object][Object]
$j('#hp-featured-item > div[id^="post-"]').each(function() {
var id=this.id.match(/post-(\d+)/);
var imgt = $j("img:eq(0)");
// I tried this but ...
I know how to hijack a link in jQuery, and I know how to find an element's parent, but I can't seem to combine the two. I have multiple divs, each of which contains a link. I want to hijack the link and update the parent div's content.
<div class="container-1">
<a href="/foo.html">Add content</a>
</div>
<div class="container-2">
...
This is actually a bigger question because I know there are several ways to solve this problem but I will try to sum it up.
What I try to do: I am using this jQuery plugin to upload files via Flash http://www.uploadify.com/. However, the element #fileInput that I supposed to bind this function to is a live element which is generated aft...
The code below will show / hide a div on click. It works perfectly for the first div listed, but doesn't work for any of the others. Is there a way to have the function apply to all the elements with the same class names? It should, of course, only open / close the div to which it's being applied (i.e., clicking on the Second Div togg...
For example if you had a wizard that had step by step directions asking for information, each div would have the controls needed for each step (only one div shows at a time). Then you would swap through them one by one, hence going through a multi-step process all in one page load. Is this pretty easy to do in jQuery? Could you have one ...
Hello, I have a jquery-code which using selectors (from current document). Now I want to move this code into another file(js) and just include from this document. Could I do it without any editing? So, will jquery-code works right?
...
I have a sidebar menu that opens and closes hidden parts of the page through jQuery. The link both fades the hidden content and also adds and removes a class to the link. So for example the html / css
<ul>
<li><a class="linkOne" href="#">Link One</a></li>
<li><a class="linkTwo" href="#">Link Two</a></li>
</ul>
<div class="linkOneBox"...
Ok.
html:
<div class="selector">
<select name="something"> //this is what myVar is referring to.
<option>stuff</option>
</select>
</div>
Say I have var:
var myVar = $(".selector").find("[name=something]");
And I want to concatenate with option:selected:
$(myVar here + " option:selected").change(function(){
//d...
Hi,
I know many have asked this question, but I think my situation is a little bit different.
I have a site where I have some ads which is Flash hidden in a because of xhtml/html compatibility issues. But the flash elements is on top of my jQuery dialogs which is not ideal.
Some solutions have suggested setting wmode to opaque but I ...
hello, i got following part of one of functions
if(continiueSend)
{
$.ajax
({
type: "POST",
url: "mailer.php",
data: "somestestdata",
timeout: 5000,
success: function(a)
{
alert(a);
},
error: function (xhr, ajaxOptions, thrownError)
{
alert(xhr.status);
alert(thrownError);...
I have created a input box that takes only digits and low case alphabets. I used this
if($("#txt").value.match(/[^0-9a-z]/)
// replace characters not needed
However now peopl cannot select the text. How to allow text selection? or Control+A?
...
Consider following:
Partial View:
<%= Html.ListBox("BlackList", Model.Select(
x => new SelectListItem
{
Text = x.Word,
Value = x.ID.ToString(),
Selected = Model.Any(y=> y.ID == x.ID...
Hi,
I am trying to validate data in the table cell when the user enters the information. Each cell in the table will have different validation methods. I have a table with 15 cells and 100 rows. some of the cells will be hidden based on some settings. so I cannot use cellIndex to define events. so to define validation rules on each cell...
I would like to create a basic URL rewrite using frames. I don't have access to .htaccess to do mod_rewrite. Is there a way using PHP, jQuery, JavaScript etc. to detect which URL has been clicked on and then open URL in new frame? Ex: user clicks on /index.php?12345 it will open in framed window /pages/12345/index.html and if they cl...
Preamble: I'm more of a PHP/MySQL guy, just starting to dabble in javascript/jQuery, so please excuse this dumb newbie question. Couldn't figure it out from the Docs.
I have a form without a submit button. The goal is to allow the user to input values into several form fields and use jQuery to total them up on the bottom in a div. The f...
I have the following code
<form id="form1" name="form1" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td ><div class="label_main" id="lab1">
<div class="label_radio">
<input type="radio" name="group1" id="r0" value="0" />
</div>
<div class="label_top...
Hello, I have such construction:
<div id="slider">
<div id="nav">
<div class="sliderPart">
<a href="#computers">
<strong>1</strong>
</a>
</div>
<div class="sliderPart">
...
Hi all.
Firs off all, I'm not sure if there will be any simple and straight forward answer to this question, but I thought I'll give it a go and try to ask.
I have this very messy bit of code:
<table cellspacing="0" cellpadding="2" border="0" width="100%"><tbody><tr><td><table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td>...