JQuery :: Creating And Deleting Items, Using Live()

Apr 6, 2011

I have some ajax functionality I have made, this basically creates an item in a database by an add button, the items are in a li.

I have a delete button span which when pressed shows a confirm or cancel buttons which are hidden initially, If i have more than one item in the list is will show and hide them on all the items in the list, heres the code

$('.source_delete').live('click', function(){
//Fade out delete button
$('.source_delete').fadeOut();
//Show confirm button

[Code]....

I need the show and hide not to apply to all items in list, the issue is im aware you cannot use live and each together, is this correct?? how can I go about doing this?

View 4 Replies


ADVERTISEMENT

Deleting Items

Oct 21, 2005

I add items to a list of ids within a <TD> named lstCarts using the
following code:

function lstCarts_ondblclick()
{
index = NewProgram.lstCarts.selectedIndex;
if (index != -1)
{
vID = NewProgram.lstCarts.options[index].value;
vText = NewProgram.lstCarts.options[index].text;
NewProgram.lstNewCarts.options[NewProgram.lstNewCarts.length] = new
Option(vText);
NewProgram.lstNewCarts.options[NewProgram.lstNewCarts.length -
1].value = vID;
eval("NewProgram.Item" + vID + ".value = " + vID);
}}

This works fine. When I highlight an item in lstNewCarts and click on
a button to delete these items from the list the following code is
executed. This doesn't work becauset the selected item does not
disappear from the list.

function lstNewCarts_ondblclick()
{
index = NewProgram.lstNewCarts.selectedIndex;
if (index != -1)
{
vID = NewProgram.lstNewCarts.options[index].value;
vText = NewProgram.lstNewCarts.options[index].text;
eval("NewProgram.Item" + vID + ".value = -1");
}}

View 3 Replies View Related

Creating And Deleting Function?

Oct 8, 2009

I've been trying to create a function that creates objects and another function that can delete them when triggered the objects code is generated server side and triggers the function passing the object data. The object data sort of looks like this

<OBJECT id="RandomNumbers" width="0" height="0"
style="position:absolute; left:0;top:0;"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
type="application/x-oleobject">

[Code].....

I've tried a few methods I looked up but whenever I try to get them to work the way I need them they throw errors... It would be very cool if you could also get it under a div tag.

View 5 Replies View Related

JQuery :: Creating New Element /w LIVE Event By Passing Object Map?

Apr 4, 2010

So, I read about the new method of passing an object map containing element properties when creating a new jQuery object (as discussed at the bottom of this article). The article says that it supports ALL events, but only gives examples of simple events that require no parameters. I'm trying to implement a live event using the following and can't get it to work:

var link = $('<a />', {
text: config.appendTextMore,
href: "#",

[code]....

View 1 Replies View Related

Accessing .attr() When Creating New Dom Elements (using .live())?

May 15, 2010

I'm trying to access the id of an image I create using .live().When creating the image I give it an id however, I am unable to retrieve that idea later using .attr()

View 2 Replies View Related

JQuery :: Dynamically Creating / Removing Items From List

Jun 3, 2009

I'm trying to dynamically create and remove items from a list, it works just fine. Sort of, I can remove items, and create items, but once an item has been created, I cannot remove it again, but I can remove the items present when the page loads.

Here is my code
<div class="list">
<div class="item">
<input type="text" value="" /> <a href="" class="removeitem">Remove this item</a>
</div><div class="item">
<input type="text" value="" /> <a href="" class="removeitem">Remove this item</a>
</div><a href="" class="additem">Add item to list</a>
</div><script type="text/javascript">
// Add item to list
$('.additem').click(function(){
var template = $($(this).prev().get(0)).clone();
template.insertBefore($(this));
return false;
});
// Remove item from list
$('.removeitem').click(function(){
$(this).prev().parent().remove();
return false;
});
</script>
I can remove the 2 original items, but when I create new ones, they cannot be removed.

View 1 Replies View Related

Ajax :: Creating Page That Displays 'live' Data From Mysql Database?

Jun 6, 2010

could someone please point me in the right direction for creating an AJAX page that displays "live" data from a mysql database? I need the page to update its self every time data changes in a mysql table.

View 1 Replies View Related

JQuery :: [apycom Menu] Submenu Items Showing As Top Level Items In IE?

Jan 10, 2010

version of Apycom's jQuery menu; you can find itat http://apycom.com/ and it is looking really good.I have uploaded files, and published it on a test site - www.flexin.beUnfortunately, some of the submenus starting from the second that haschildren elements, it adds the item on the top level in InternetExplorer.Does anyone on this list has any experience with this library?

View 2 Replies View Related

JQuery :: Deleting Images That Containing X.jpg?

Apr 11, 2010

I'm trying to look for images that contain 'x.jpg' and remove its <img> container. I'm using the :contains and remove feature without success. What am I doing wrong?

$("img:contains('x.jpg')").remove();

View 1 Replies View Related

JQuery :: Deleting A Node From XML String?

Jun 11, 2010

$(document).ready(function () {
var EmailXml = "<Set>";
EmailXml += "<Email>"
EmailXml +="<Type>0</Type>";
EmailXml +="<Addr>amol@gmail.com</Addr>";

[Code].....

Now I am trying to delete a node directly from above EmailXml , though it is possible with above code when case matches with my Type, I can do some string operations and get the result. But is there any other method which removes the node directly ?

View 1 Replies View Related

JQuery :: Deleting Records With Classic ASP

Mar 8, 2010

I'm using jquery to pass trough data to another page where I want to insert and delete a record. But the problem is that jquery only inserts or deletes the records and not both together. I use following code:
For jquery:
$(document).ready(function(){
$("#btnAddPayment").click(payment);
});
//example 1
function payment(){
$.ajax({
type:"POST",
url: "acceptPaymentExecute.asp",
dataType: "application/x-www-form-urlencoded", .....

objRS = objConn.execute(strInsertPayment)
objRS = objConn.execute(strDeleteMemberPayment)
objRS.close()
set objRS = nothing
objConn.close()
set objConn = nothing
The queries work but not together. If I comment the insert statement, my page executes the delete statement. I already tried to call another object for my delete statement but it does the same.

View 4 Replies View Related

JQuery :: .removeClass Is Deleting All Classes?

Dec 3, 2010

I am just starting to learn jQuery. I checked documentation on this and still can't figure this out:Here is my goal:I have these three rowBlocks where I want to make the first and last classes renamed to

"rowBlockTop" and "rowBlockBottom":
<div class="rowContainer">
<div class="rowBlock clearFix">

[code]....

View 1 Replies View Related

JQuery :: Deleting Textarea Values From A Form?

Feb 9, 2010

I have a simple, three-field form that I am setting default values from within my jquery script. When a user clicks on a field the default values are removed, leaving that field blank for the user to type into.

The form accepts the default values from my jQuery script just fine. And when I click on the "to" and "from" fields, the default text is, in fact, removed. The problem is when I click on the textarea, the default value does not get removed.

Here is my html:
<form class="blogForm" name="blogForm">
<Input class="blogFormTo" type="text" name="email" />
<Input class="blogFormFrom" type="text" name="email" />
<textarea class="blogFormNote">

View 2 Replies View Related

Jquery :: Deleting Last X Rows (Children Of DIV Fields)

May 8, 2009

I have the following html and I'm trying to figure out how to delete the last rows the are children of div feed. I only want to leave a max of the first x rows. First I count them using $numdivs = $("#feed > div").size() - 1;. Then, I'm a bit lost on what to do next and have looked at the docs for children and thought of trying to traverse but can't seem to get it to work.

<body>
<div id="search">
</div>
<div id="feed">
<h2>Feed</h2>
<div id="firstrow" class="row"/>
<div id="1741946459" class="row">Test data for the first row</div>
<div id="1741946327" class="row">Test data for the second row</div>
<div id="1741939928" class="row">Test data for the blah row</div>
<div id="1741939928" class="row">Test data for the blah2 row</div>
<div id="1741939928" class="row">Test data for the blah3 row</div>
</div>
</body>

View 1 Replies View Related

JQuery :: Updating / Adding And Deleting Objects Nested In Other Ones?

Aug 9, 2011

I have the following object:
var wDefaults = {
"skin":1,
"pagewidth":"960px",
"c1col":[
{"wid":"w001","pcol":0,"wpos":0,"wclosed":"false","wcollapsed":"true"}
],
"c3col":[
{"wid":"w002","pcol":0,"wpos":0,"wclosed":"false","wcollapsed":"false"},
{"wid":"w003","pcol":0,"wpos":1,"wclosed":"false","wcollapsed":"false"},
{"wid":"w004","pcol":0,"wpos":2,"wclosed":"false","wcollapsed":"false"},
{"wid":"w005","pcol":1,"wpos":0,"wclosed":"false","wcollapsed":"false"},
{"wid":"w006","pcol":1,"wpos":1,"wclosed":"false","wcollapsed":"false"},
{"wid":"w007","pcol":1,"wpos":2,"wclosed":"false","wcollapsed":"false"},
{"wid":"w008","pcol":1,"wpos":3,"wclosed":"false","wcollapsed":"false"},
{"wid":"w009","pcol":2,"wpos":0,"wclosed":"false","wcollapsed":"false"},
{"wid":"w010","pcol":2,"wpos":1,"wclosed":"false","wcollapsed":"false"}, {"wid":"w011","pcol":2,"wpos":2,"wclosed":"false","wcollapsed":"false"}
]}

First, how do I access a single value? I've tried some of the examples I saw on the forum, but nothing happened. The alert did not fire:
alert(wDefaults.c3col[0].wid); //first try
alert(wDefaults.c3col.0.wid); //second try
var obj = wDefaults.c3col[0]; //third try
alert(obj.wid);

The nested objects are the properties for widgets within a portal. After the user moves around the widgets, I need to update the object, putting the widgets in a different order within c3col and updating the values saved in pcol, wpos, wclosed, & wcollapsed. I also may need to add or delete an object, for example, delete wid=w003 and add a new one called w012.

My logic would be:
for each widget on the page
found = false
find the object in c3col where wid == x and update its other values
. set found = true
if found == false then add a new object to c3col with x & its properties
end for
for each object in c3col
if that wid isn't found in the list of widgets on the page, delete it from c3col
end for
sort the objects under c3col by pcol and then wpos

The red parts are the ones I'm unclear about how to do it. My basic questions are:
(1) How do you access a single nested object?
(an object within c3col, find and change its values)
(2) How do you add a new nested object to an existing object?
(add a new object to c3col)
(3) How do you delete an nested object?
(remove an object from c3col)
(4) How do you sort nested objects?
(sort the objects in c3col by pcol and wpos)

View 3 Replies View Related

JQuery :: Deleting Options In Dropdownlist Based On Value Length?

Jul 9, 2010

delete all option in a dropdown that contain value length of more than zero ie all options that doesnt have value="".

View 1 Replies View Related

JQuery :: Deleting From Array Of Local Storage Keys?

Dec 15, 2011

I'm trying to present a collapsible list if keys which when expanded will have a delete button at the end of it. My problem is that when this code runs, the confirmation alert shows the key name as the last one read from the array for all items. Here's the complete function:

[Code]...

why this code invokes the deleteNote function with the last key name for all notes?

View 1 Replies View Related

Jquery :: Deleting Individual Elements In List When Clicked

Feb 18, 2009

I am looking for a way to add an id attribute to a div element I append to my document so that i can find the id later and delete it. So far, no luck with jquery .each loop trying to assign unique value and add incrementing value to each of them. In my code, they all seem to have the same id and when I click again it just appends the same value again to all of them.

//first I add a title to the list using append.
function addTitle () {
$('.myList-box').append('<div class="mylistitem"><div class="mylistitem-image"><img width="30" height="40" src="[URL]small.aspx?TitleID=' + titleid + '"/></div><div class="mylistitem-title">' + title + '</div><div class="mylistitem-options"><a href="javascript:removetitle();">Delete From List</a></div>');
}
// then I need a click function, that indexes all the current .mylistitem(s) and allows me to find the id I am clicking on so I can delete it!
function removetitle() {
$(".mylistitem").each(function(i) {
this.id = this.id + "_" + i;
});
var item = $(".mylistitem").attr("id");
alert(item);
}

View 6 Replies View Related

JQuery :: Sortable Tabs \When Try Deleting One Of Them After Changing Their Position, This Is Another Which Is Removed?

Apr 30, 2010

It have a problem with the sortable tabs. When i try deleting one of them after changing their position, this is another which is removed. have read that tabs don't check the new DOM positions.

View 1 Replies View Related

Copying Listbox Items - Do All The Movement Functionalities Of The Listbox Items Client Side

Feb 25, 2011

I have an ASP.net page where I load a record set server side and upload it into a listbox. I'm trying to do all the movement functionalities of the listbox items client side. Specifically, I'm trying to figure out how to copy selected listbox items from one listbox to another -- on button click. I've searched for a while, but every example that I found moves the actual item into another listbox, I just want to copy the selected item to another listbox.

View 6 Replies View Related

JQuery :: Using .live() With .each()

Jul 22, 2010

I have a function that I apply to every anchor tag in a div called listnav. I do so like this:

$('.listnav a').each(function(i, el) {
$(el).click(function(ev) {
ev.preventDefault();
var href = $(this).attr('href');

[Code]....

This,among other things, causes a function called load to be called on the href of the anchor. This works fine. Howver I want to use the live() function with this as I am going to dynamically change the links in the listnav div. I tried doing it like this :

$('.listnav a').each(function(i, el) {
$(el).live('click',function(ev) {
ev.preventDefault();

[Code]....

But that does not work. My question is how would I go about changing this function so that the actions are applied to any new anchors added to the div dynamically?

View 2 Replies View Related

For Deleting Child

Feb 28, 2006

will u suggest me how to delete child from node. i have a xml file. There are four subnodes in the Contact element i have to delete subnodes value from file...

View 2 Replies View Related

Deleting Cookie

Feb 5, 2008

Alright, I have a problem killing a cookie. I'm able to succesfully create a cookie with php (or rather several cookies). If it matters, heres the code:

setcookie("loggedin", "true", $inTwoMonths, "/testzone/", "excalo.com");
setcookie("username", $unames[$i], $inTwoMonths, "/testzone/", "excalo.com");
setcookie("password", $passes[$i], $inTwoMonths, "/testzone/", "excalo.com");

The files are in a folder called testzone in excalo.com.

I need to delete them (that is, the cookies) with javascript. Interestingly, when I run the same files without the "/testzone/" in my main directory, everything is fine and dandy. When I run them in the testzone folder, it doesn't work. FF/Firebug aren't giving me errors. Neither is PHP. Here's the javascript: Code:

View 5 Replies View Related

Deleting Cookies

Nov 28, 2005

I've been trying for the last few weeks(on and off, mind you) to get this piece of code working, but to no avail.

My problem is small, but all the solutions I have tried dont seem to work.
I've googled the life out of it and got a lot of different scripts which are supposed to set the expiry date in the past and the cookie disappears.....
But none of these worked, so this is what I am left with: Code:

View 3 Replies View Related

Deleting Row(s) From Table ?

Mar 6, 2011

My table had the following layout.

Code:

After clicking an add rows button, the two rows are cloned and appended as follows with a checkbox added as shown.

Code:

I want to be able to delete rows 3&4 by selecting the checkbox in row 3 and clicking a delete rows button. Regardless of how many sets of rows have been previously added, any set of rows can be deleted by selecting the appropriate checkbox(es) and clicking delete button. I'm trying to figure out how this can be done. My thinking is if checkbox is checked, calculate row index. I would then have to call deleteRow twice on that row index. Is there a better way of doing this?

View 9 Replies View Related

JQuery :: On() Vs. Live() Using Version 1.7.1?

Jan 10, 2012

I am exhausted today, not to include the funk that the BCS national championship put me in, so I must be either crazy or missing something. When I do the following the code works;

[Code]...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved