Click here to Skip to main content
11,496,146 members (685 online)

JavaScript

The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
 
AnswerRe: how can we set random image in my asp website? Pin
Sandeep Mewara4-Jan-13 3:59
mvpSandeep Mewara4-Jan-13 3:59 
GeneralRe: how can we set random image in my asp website? Pin
khiladi78622-Jan-13 1:52
memberkhiladi78622-Jan-13 1:52 
GeneralRe: how can we set random image in my asp website? Pin
Sandeep Mewara22-Jan-13 3:34
mvpSandeep Mewara22-Jan-13 3:34 
Questiongenerate random numbers from specific array Pin
aeman29-Dec-12 23:16
memberaeman29-Dec-12 23:16 
AnswerRe: generate random numbers from specific array Pin
Sandeep Mewara4-Jan-13 4:06
mvpSandeep Mewara4-Jan-13 4:06 
AnswerRe: generate random numbers from specific array Pin
Joe DiNatale4-Jan-13 10:28
memberJoe DiNatale4-Jan-13 10:28 
AnswerRe: generate random numbers from specific array Pin
John Y.19-Feb-13 6:47
memberJohn Y.19-Feb-13 6:47 
Questionaccess info popup page Pin
apadana_198928-Dec-12 7:58
memberapadana_198928-Dec-12 7:58 
AnswerRe: access info popup page Pin
Sandeep Mewara4-Jan-13 4:13
mvpSandeep Mewara4-Jan-13 4:13 
AnswerRe: access info popup page Pin
vinodkumarnie18-Jan-13 23:56
membervinodkumarnie18-Jan-13 23:56 
Questioncontrol other page Pin
apadana_198928-Dec-12 7:50
memberapadana_198928-Dec-12 7:50 
AnswerRe: control other page Pin
aeman29-Dec-12 23:34
memberaeman29-Dec-12 23:34 
AnswerRe: control other page Pin
jkirkerx31-Dec-12 11:34
memberjkirkerx31-Dec-12 11:34 
QuestionProblem With jQuery AppendTo and Data Attributes [modified] Pin
AnalogNerd28-Dec-12 4:41
memberAnalogNerd28-Dec-12 4:41 
I've run into a rather interesting, and frustrating bug that I'm hoping someone has some experience with or can help me work around.

Here's the scenario, and I've also set up a fiddle to show it [^]


I have a div with data-location="1"

If I move this div like this

$("#myDiv").appendTo("#someOtherDiv");

and then change the data-location value

$("#myDiv").data("location", "newValue");

I can no longer find the element using the data-location attribute.

This returns 0
$("[data-location='newValue']").length;

This returns 1
$("[data-location='oldValue']").length;

BUT, this returns newValue
$("#myDiv").data("location");

Has anyone ever run into this? Am I missing something here, or doing something wrong?

[EDIT: has some trouble with the fiddle, the link works now.]

[EDIT: SOLVED]
Apparently the .data in jquery only reads the attributes once and never sets the attributes. If you want to set data- attributes and recall them in your code you have to use the .attr() call.

modified 28-Dec-12 10:51am.

Questioncss Pin
SINNAM28-Dec-12 2:32
memberSINNAM28-Dec-12 2:32 
AnswerRe: css Pin
Keith Barrow28-Dec-12 3:33
mentorKeith Barrow28-Dec-12 3:33 
Questioncss Pin
SINNAM28-Dec-12 2:29
memberSINNAM28-Dec-12 2:29 
AnswerRe: css Pin
Sandeep Mewara4-Jan-13 4:14
mvpSandeep Mewara4-Jan-13 4:14 
AnswerFB Connect Javascript Pin
sasikumar.prs27-Dec-12 0:29
membersasikumar.prs27-Dec-12 0:29 
GeneralRe: FB Connect Javascript Pin
khiladi78631-Dec-12 6:40
memberkhiladi78631-Dec-12 6:40 
GeneralRe: FB Connect Javascript Pin
jkirkerx31-Dec-12 11:36
memberjkirkerx31-Dec-12 11:36 
AnswerRe: FB Connect Javascript Pin
Sandeep Mewara4-Jan-13 4:17
mvpSandeep Mewara4-Jan-13 4:17 
QuestionGridview Problem Pin
jojoba201122-Dec-12 6:05
memberjojoba201122-Dec-12 6:05 
AnswerRe: Gridview Problem Pin
Sandeep Mewara4-Jan-13 4:25
mvpSandeep Mewara4-Jan-13 4:25 
Questionxna4life Member 13 Points 71 Posts hard code drop down instead of using toolbar and r/s Pin
xnaLearner21-Dec-12 4:34
memberxnaLearner21-Dec-12 4:34 
Questioni m using google map its giving little bit problem. Pin
kapil sharma 4921-Dec-12 0:52
memberkapil sharma 4921-Dec-12 0:52 
AnswerRe: i m using google map its giving little bit problem. Pin
Sandeep Mewara4-Jan-13 4:31
mvpSandeep Mewara4-Jan-13 4:31 
Question"&nbsp" problem in Javascript Pin
BrianCampbellMCAD20-Dec-12 13:08
memberBrianCampbellMCAD20-Dec-12 13:08 
QuestionRe: "&nbsp" problem in Javascript Pin
Richard MacCutchan21-Dec-12 0:00
mvpRichard MacCutchan21-Dec-12 0:00 
AnswerRe: "&nbsp" problem in Javascript Pin
BrianCampbellMCAD21-Dec-12 2:42
memberBrianCampbellMCAD21-Dec-12 2:42 
GeneralRe: "&nbsp" problem in Javascript Pin
Richard MacCutchan21-Dec-12 3:06
mvpRichard MacCutchan21-Dec-12 3:06 
AnswerRe: "&nbsp" problem in Javascript Pin
jkirkerx31-Dec-12 11:39
memberjkirkerx31-Dec-12 11:39 
Questionjquery tabslideout plugin and want to detect when div slide in and out Pin
Tridip Bhattacharjee20-Dec-12 4:54
memberTridip Bhattacharjee20-Dec-12 4:54 
AnswerRe: jquery tabslideout plugin and want to detect when div slide in and out Pin
vbmike21-Dec-12 7:25
membervbmike21-Dec-12 7:25 
GeneralRe: jquery tabslideout plugin and want to detect when div slide in and out Pin
Tridip Bhattacharjee23-Dec-12 7:35
memberTridip Bhattacharjee23-Dec-12 7:35 
GeneralRe: jquery tabslideout plugin and want to detect when div slide in and out Pin
vbmike23-Dec-12 12:31
membervbmike23-Dec-12 12:31 
QuestionConvert HTML to PDF (Client Side) Pin
Phanindra26116-Dec-12 21:07
memberPhanindra26116-Dec-12 21:07 
QuestionRe: Convert HTML to PDF (Client Side) Pin
ryanb3118-Dec-12 6:05
memberryanb3118-Dec-12 6:05 
AnswerRe: Convert HTML to PDF (Client Side) Pin
Phanindra26118-Dec-12 18:50
memberPhanindra26118-Dec-12 18:50 
GeneralRe: Convert HTML to PDF (Client Side) Pin
J4amieC18-Dec-12 22:29
memberJ4amieC18-Dec-12 22:29 
QuestionCan't figure out why the currentSlide goes 0-3-2 Pin
jkirkerx16-Dec-12 13:08
memberjkirkerx16-Dec-12 13:08 
AnswerRe: Can't figure out why the currentSlide goes 0-3-2 Pin
jkirkerx17-Dec-12 9:40
memberjkirkerx17-Dec-12 9:40 
AnswerSo I rewrote the program from scratch, works pretty good now, feel free to build on it Pin
jkirkerx19-Dec-12 18:45
memberjkirkerx19-Dec-12 18:45 
GeneralRe: So I rewrote the program from scratch, works pretty good now, feel free to build on it Pin
Richard MacCutchan20-Dec-12 0:15
mvpRichard MacCutchan20-Dec-12 0:15 
GeneralRe: So I rewrote the program from scratch, works pretty good now, feel free to build on it Pin
jkirkerx20-Dec-12 7:18
memberjkirkerx20-Dec-12 7:18 
GeneralRe: So I rewrote the program from scratch, works pretty good now, feel free to build on it Pin
Richard MacCutchan20-Dec-12 7:39
mvpRichard MacCutchan20-Dec-12 7:39 
QuestionJava Script Pin
manoj s sherje14-Dec-12 2:05
membermanoj s sherje14-Dec-12 2:05 
QuestionRe: Java Script Pin
ProgramFOX14-Dec-12 2:33
memberProgramFOX14-Dec-12 2:33 
QuestionRe: Java Script Pin
ryanb3118-Dec-12 6:06
memberryanb3118-Dec-12 6:06 
AnswerRe: Java Script Pin
manoj s sherje19-Dec-12 2:01
membermanoj s sherje19-Dec-12 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 29 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid