-1

I found a Jquery's select function,

but I have confuse in this syntax , I dont know what it effect.

Does anyone can help me for explain this syntax do or what it effect ?

$("<table>",{ id: "tableName"  }))

This syntax are so weird to me.

Jquery selector can select element without ID or class , just a html element ? and what does { } mean in that selector ?

In confused... and didn't find any tutorial about that...

rifa_at_so
  • 326
  • 1
  • 6
  • 18
Vic
  • 758
  • 2
  • 15
  • 31

1 Answers1

3

This is not a select statement.

It creates a table object with the ID of tableName -

Here is the API documentation: http://api.jquery.com/jQuery/#jQuery2

and here is a post on preferred usage

The preferred way of creating a new element with jQuery -

That said, when you do

var $table = $("<table>",{ id: "tableName"  }));

the variable $table will contain the jQuery object of the created table for further manipulation such as appending a thead and tbody with content

Community
  • 1
  • 1
mplungjan
  • 169,008
  • 28
  • 173
  • 236