{"id":961,"date":"2013-02-05T15:39:38","date_gmt":"2013-02-05T15:39:38","guid":{"rendered":"https:\/\/ibex.tech\/javascript\/?p=961"},"modified":"2022-02-17T07:14:46","modified_gmt":"2022-02-17T07:14:46","slug":"id-vs-class","status":"publish","type":"post","link":"https:\/\/ibex.tech\/javascript\/id-class-etc\/id-vs-class","title":{"rendered":"ID vs Class"},"content":{"rendered":"<h4>\nID<br \/>\n<\/h4>\n<p>\nThis following is function:\n<\/p>\n<pre>\r\n<code>\r\n$(&#39;#SomePageElementId&#39;).live(&#39;vmousedown&#39;, function() {\r\n\t\t\t \/\/Do something\r\n});\r\n<\/code><\/pre>\n<p>\nis based on an element ID like this:\n<\/p>\n<pre>\r\n<code>\r\n&lt;div id=&quot;SomePageElementId&quot;&gt;\r\n...\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<h4>\nClass<br \/>\n<\/h4>\n<p>\nBut you can use a class name instead of an ID, with the function instead like this:\n<\/p>\n<pre>\r\n<code>\r\n$(&#39;.SomePageElementClass&#39;).live(&#39;vmousedown&#39;, function() {\r\n\t\t\t \/\/Do something\r\n});\r\n<\/code><\/pre>\n<p>\nbased on an element class like this:\n<\/p>\n<pre>\r\n<code>\r\n&lt;div class=&quot;SomePageElementClass SomeOtherClass SomeOtherOtherClass&quot;&gt;\r\n...\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>\n&nbsp;\n<\/p>\n<p>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ID This following is function: $(&#39;#SomePageElementId&#39;).live(&#39;vmousedown&#39;, function() { \/\/Do something }); is based on an element ID like this: &lt;div id=&quot;SomePageElementId&quot;&gt; &#8230; &lt;\/div&gt; Class But you can use a class name instead of an ID, with the function instead like this: $(&#39;.SomePageElementClass&#39;).live(&#39;vmousedown&#39;, function() { \/\/Do something }); based on an element class like this: &lt;div [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104],"tags":[],"class_list":["post-961","post","type-post","status-publish","format-standard","hentry","category-id-class-etc"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/comments?post=961"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/961\/revisions"}],"predecessor-version":[{"id":1346,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/posts\/961\/revisions\/1346"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/media?parent=961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/categories?post=961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/javascript\/wp-json\/wp\/v2\/tags?post=961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}