I have had a look at some javascript functions in the form:
$('#css-style-definition').click(function()
var newText = $('#console-msgs').html();
Does anyone recognise the syntax?
Where can I get information on what is happening here?
I have had a look at some javascript functions in the form:
$('#css-style-definition').click(function()
var newText = $('#console-msgs').html();
Does anyone recognise the syntax?
Where can I get information on what is happening here?
You're missing a bunch so you either have broken javascript or you didn't copy/paste directly. It should look like:
$('#css-style-def').click(function () {
var newText = $('console-msgs').html();
});
$ is (in most cases) a jQuery function that finds an element based on the CSS selector passed so that particular code says: Find the element with the id css-style-definition, and when someone clicks on it set the variable newText equal to whatever the element with the id console-msgs contains.
ShawnCPlus is right about the missing elements in the snippet.
You will need to include the jQuery library in your page. See this article for different ways to do that:
http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=609
To learn more about jQuery itself, the best place to start is the project site:
:)
I was just posting two examples of the syntax.
I was just trying to look at someone else' code and see if I could work out what was happening.
I thought I knew Javascript, but I have never seen anything like this.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.