$(ID).data('object') doesn't seem to work in mobile

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I built a custom signature component using jSignature and would like to use it on mobile, but mobile doesn't seem to like the $('MyComponentId').data('object') syntax. Help?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
$('#MyComponentId').data('object') only works for several desktop components, and it returns something slightly different than what .data('component') returns for these components --- for most components, including all mobile components, what you want to get access to is the Component object, and this is returned through either skuid.$C('MyComponentId') if your component has a Unique Id, or element.data('component') if you have a jQuery-wrapped element reference in context.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Zach,

Does this mean that I can replace element.data('object') with element.data('component') and get the same results?
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
No, it does not. Where .data('object') is available, it usually returns something different than .data('component')
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Hmm, unfortunate. Ok.