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?

Recommended Answers

All 3 Replies

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.

:)

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.

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.