During early in learning how to implement unobtrusive js (using Rails & jQuery) I've run into an issue of how to (re)bind a submit button/form after .load(ing) new content that includes a form.
I've set up a 'create new item' form to show at the top of a lising of items (when the user clicks on a create button)
sale_case/show/_requirme...
Hi,
I have a delegate like:
$('#panel').delegate('li', 'click', function(event) {
var target = $(event.target);
// how do we get the ID of 'target'?
var id = target.getId(?);
});
Yeah I'm just not sure how to get 'target's ID, because I want to check if it is a particular element to perform some action on later.
Thanks
...
Hello,
I have written code to overlay a SWF above a HTML button. I use the offset function from jQuery to get the coordinates and move the SWF. Unfortunately, it seems like the SWF do not get moved.
var offset = $("#button").offset();
$("#SWF").offset(offset);
$("#SWF").css({'left':offset.left, 'top': offset.top});
$("#SWF").offset({ ...
Can this be done? I'm building a template generator complete with resizable and draggable elements inside a preview window. Problem is, when I go to get the HTML generated, each of the elements have all the JQueryUI classes and divs added, which are not desirable in the final product. I'd like the output HTML to be simple enough that I c...
Hi!
I'm working on a jQuery plugin (a jQuery UI widget) called Smooth Div Scroll where I need to store references to intervals that are specific to each individual instance of the plugin on the page. If i just write something like this:
var myInterval = setInterval(function() {
alert("Hi!");
}, 100);
...the variable myInterv...
OK Ive written this neat javascript 'thing' using jquery and ajax. Its all based on the idea that a div has an attribute that lets you write inside the div. (contenteditable=true). I thought it would be cool to make a chatroom type thing out of it, and holy cow its doing some cool stuff(*), but I have an issue.
Using ajax I post to a p...
I'm loading an xml document using JavaScript (Jquery $.ajax).
I need to be able to count the number of branches (b) separating 2 text nodes (s).
E.g.
<b n="Archaea">
<s>Archaea</s>
<b n="Eubacteria">
<s>Cyanobacteria</s>
<s>Spirochaete</s>
<b n="Seaweeds">
<s>Red ...
I have a confirmation dialogue that pops after you hit ("#step0Next") on a form wizard. Currently it pops after you hit the button on the next step. I need it to pop when you hit the button on THAT step (step 1) not when it goes to step 2. How do I stop the default action of the button until the user click's "OK" in the dialogue?
$("#st...
I have a timed event I want to behave differently accordingly to what HTML element the mouse pointer is on.
Is there a way, assuming I have the HTML element, to know if the mouse pointer is currently on top of it.
I am well aware of the onmouseover/onmouseout events and how to use them.
I am using JQuery.
I am obviously looking for some ...
It doesn't in FF/Chrome and I don't think it should in IE. after all $() doesn't return a plain object, but an instance of $. Am I wrong?
...
$(document).ready(function(){
$("#container").click(function(){
$("#myiframe").attr('src', 'example.com');
});
});
This doesn't work? The container is actually is a lightbox. The reason I am not defining the src attribute by default is because iframe loads even when lightbox isn't shown yet.
...
I would like to add a Title attribute to a row and the value is retrieved from the row's sibling which is hidden, unless clicked. I wanted to make it generic enough to handle when some screens don't have the hidden row with the text.
Here is the first pass that works:
$(function() {
$("td.commandText pre").each(function(index) {
...
Currently I used code from http://dimox.net/demo/simplest-universal-jquery-tabs-script/
Example on Tab 3 have a contact form. After we submitted the form (refresh) I want the tab still on Tab 3. How to implement it?
(function($) {
$(function() {
$('ul.tabs').each(function() {
$(this).find('li').each(function(i) {
$(this)....
I want to find all the elements on my page that have a 'name' attribute containing 'x' or 'y' and add a certain class to those elements.
So, the logic I'm looking to apply is
If anything has 'x' or 'y' in the name attribute then add .yepItHasXorY
It seems like a simple thing. I understand how to search based on an ID or Class but not...
I have a drop down menu with 3 values. each has an option id. I want to make an ajax request and update a div based on the response from that request.
I have sample code on jsbin in which I am trying to make ajax request to imdb. I don't want to parse the response back from imdb but want someone to show me how to update a div based o...
Hi
I want to use jQuery to get the checked radio button out of a radio button set.
The form object here is not a jQuery object but rather "normal" javascript object.
I want the following:
//"where" should fliter the jQuery Array
var myVal = $(form.RadioSet).where(':checked').val();
I know I can get my results with this:
var myVa...
I run into problems to pass a javascript object context into the callback handler of a JSONP ajax request, when the ajax provider predefines its callback. (Flickr is the service provider).
I'll give a simplified example:
function Person(anId) {
this.name;
this.id = anId;
var self = this;
this.loadName = function() {
$.ajax({
...
my HTML:
<li class="accept accepted" name="javascript_required" style="display: block; " id="accept">
<div id="accept-text" style="display: block; ">
Contract was Accepted
</div>
<a href="/view/close_contract/89?status=2" rel="facebox">Accept This Controct</a></li>
then my jQuery th...
What is the difference between $(this) and this in jQuery ? Here are two different usage :
$(document).ready(function() {
$("#orderedlist").find("li").each(function(i) {
$(this).append( " BAM! " + i );
});
});
$(document).ready(function() {
// use this to reset several forms at once
$("#reset").click(function() {
...
Hi,
I've got a layout like this:
<div id='parent'>
<div id='row_0'></div>
<div id='row_1'></div>
<div id='row_2'></div>
...
<div id='row_N'></div>
</div>
At some point, I want to remove all div "rows" above a certain index, like:
for (var index = 1; index < $('#parent').children.length; index++) {
$('#p...