Search code examples
javascriptjquerymeta

JQuery how to get the content of a meta value that can have two different names?


Using JQuery I can get the contents of a meta with name PageID like this:

$("meta[name='PageID']").attr('content')

How about when the name can have two different values e.g. PageID1 or pageId2 then I'd like to do:

$("meta[name='PageID1' || name='PageId2']").attr('content')

but this doesn't work.


Solution

  • You can select it like this: $("meta[name='PageID1'],meta[name='PageId2']").attr('content')