Can someone explain how the following js syntax works?
Is this a function?
Why is the syntax like this?
How does it work (accessed)?

SomeName(function()
{
	otherFunction();
	
	var form = document.forms.passengerInformation;
	
    
    toggleCreateProfileFields();
	SomeName("#createUserProfileCheckbox").click(function() {
		toggleCreateProfileFields();
	});
});

Recommended Answers

All 2 Replies

Looks a little like jquery or some other Javascript library is being used.
Libraries like jquery make javascript so much easier to use.

Instead of writing getElementById("createuserprofilecheckbox")
in jquery you'd write $("#createuserprofilecheckbox")

I'm guessing the above function may have been written for a different library, personally i'm only familiary with jquery.

Yes! I think you are correct! Thanks! I just found this bit of code, so I think my function is an extension of jQuery.

var SomeName=jQuery.noConflict();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.