0

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?

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by davecoventry
0

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.

0

:)

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.