Click here to Skip to main content
15,886,110 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionRe: Angular Js, MongoDB, Javascript Pin
Richard MacCutchan26-May-15 21:55
mveRichard MacCutchan26-May-15 21:55 
AnswerRe: Angular Js, MongoDB, Javascript Pin
Member 1166176426-May-15 22:20
Member 1166176426-May-15 22:20 
GeneralRe: Angular Js, MongoDB, Javascript Pin
Richard MacCutchan26-May-15 23:27
mveRichard MacCutchan26-May-15 23:27 
GeneralRe: Angular Js, MongoDB, Javascript Pin
Member 1166176427-May-15 0:38
Member 1166176427-May-15 0:38 
GeneralRe: Angular Js, MongoDB, Javascript Pin
Richard MacCutchan26-May-15 23:30
mveRichard MacCutchan26-May-15 23:30 
AnswerRe: Angular Js, MongoDB, Javascript Pin
ZurdoDev27-May-15 2:05
professionalZurdoDev27-May-15 2:05 
QuestionDisplay value from database in jvector Map Pin
Member 1127102925-May-15 0:26
professionalMember 1127102925-May-15 0:26 
QuestionHow to read UI element value using jQuery (context vs find) ? Pin
Anjum.Rizwi25-May-15 0:03
professionalAnjum.Rizwi25-May-15 0:03 
Do you have any preferences for below code code snippet? What approach do you follow when your site have too many fields.

Option 1:
JavaScript
PriorityOfAccessModel:
                {
                    Id: $('#divPriorityAccess #Id').val(),
                    FamilyId: $('#divkPriorityAccess #FamilyId').val(),
                    ChildId: $('#divkPriorityAccess #ChildId').val(),
                    Comment: $('#divkPriorityAccess #Comment').val(),
                    CreatedBy: $('#divkPriorityAccess #CreatedBy').val(),
                    CreatedOn: $('#divkPriorityAccess #CreatedOn').val(),
                    Categories: accessPriority.getCategory(),
                    Allocating: { Id: allocating }
                }

Option 2 :
JavaScript
var $x = $('#divPriorityAccess');

                    var accessModel =
                    {
                        Id: $x.find('#Id').val(),
                        FamilyId: $x.find('#FamilyId').val(),
                        ChildId: $x.find('#ChildId').val(),
                        Comment: $x.find('#Comment').val(),
                        CreatedBy: $x.find('#CreatedBy').val(),
                        CreatedOn: $x.find('#CreatedOn').val(),
                        Categories: accessPriority.getCategory(),
                        Allocating: { Id: allocating }
                    };

Option 3:
JavaScript
var $y = $('#divkPriorityAccess');
                    var accessModel =
                    {
                        Id: $('#Id', $y).val(),
                        FamilyId: $('#FamilyId', $y).val(),
                        ChildId: $('#ChildId', $y).val(),
                        Comment: $('#Comment', $y).val(),
                        CreatedBy: $('#CreatedBy', $y).val(),
                        CreatedOn: $('#CreatedOn', $y).val(),
                        Categories: accessPriority.getCategory(),
                        Allocating: { Id: allocating }
                    };

Context:
Quote:
$('.child', parentContext);
Ops/Sec: 105,442 ±7.03% fastest

Find:
Quote:
$(parentContext).find('.child');
Ops/Sec: 113,119 ±10.53% fastest


My above finding is based on
Quote:
jQuery Selector Benchmark

Hope It will help.

Thank You,
Anjum Rizwi


modified 25-May-15 7:27am.

AnswerRe: How to read UI element value using jQuery (context vs find) ? Pin
Libin Emmanuel25-May-15 2:07
Libin Emmanuel25-May-15 2:07 
AnswerRe: How to read UI element value using jQuery (context vs find) ? Pin
Richard Deeming27-May-15 2:22
mveRichard Deeming27-May-15 2:22 
QuestionHow to call ajax in php databse file in jvector map? Pin
Member 1127102920-May-15 1:49
professionalMember 1127102920-May-15 1:49 
QuestionRe: How to call ajax in php databse file in jvector map? Pin
ZurdoDev20-May-15 8:56
professionalZurdoDev20-May-15 8:56 
QuestionjQuery validates all required fields except file upload. Pin
samflex19-May-15 8:29
samflex19-May-15 8:29 
AnswerRe: jQuery validates all required fields except file upload. Pin
ZurdoDev20-May-15 8:56
professionalZurdoDev20-May-15 8:56 
GeneralRe: jQuery validates all required fields except file upload. Pin
samflex21-May-15 2:40
samflex21-May-15 2:40 
GeneralRe: jQuery validates all required fields except file upload. Pin
Richard Deeming21-May-15 5:51
mveRichard Deeming21-May-15 5:51 
QuestionHow to pass image in javascript? Pin
Shän Yü18-May-15 2:56
Shän Yü18-May-15 2:56 
QuestionRe: How to pass image in javascript? Pin
2Programmer7829-May-15 11:38
2Programmer7829-May-15 11:38 
QuestionBase64 string corrupted or truncated Pin
JeganMaria18-May-15 0:51
JeganMaria18-May-15 0:51 
Questiondesign a game Pin
Member 116724807-May-15 9:17
Member 116724807-May-15 9:17 
AnswerRe: design a game Pin
ZurdoDev7-May-15 9:22
professionalZurdoDev7-May-15 9:22 
Questiondesign a game Pin
Member 116724807-May-15 9:15
Member 116724807-May-15 9:15 
AnswerRe: design a game Pin
ZurdoDev7-May-15 9:23
professionalZurdoDev7-May-15 9:23 
JokeRe: design a game Pin
CodeReady7-May-15 21:32
CodeReady7-May-15 21:32 
GeneralRe: design a game Pin
Sascha Lefèvre31-May-15 10:02
professionalSascha Lefèvre31-May-15 10:02 

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

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