0

I want to use the delegate() method to call my JS script to affect form elements BEFORE the JQM changes them but I am having difficulty. I need this because I need my JS converting radios to selects and have JQM display them as selects (so they need converting before JQM modifies the elements).

$( document ).delegate("body", "pagebeforecreate", function() {
    convertToDD("71471a43517b09");
});

The above is how I am calling my JS call, but it simply displays an infinite loading circle when loading the page.

My little brain is unfortunately too little to be able to follow exactly how to manipulate this function to understand what is going on to resolve.

Am I either doing something wrong (which obviously I must be), is there a better way to achieve this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Phish
  • 774
  • 3
  • 11
  • 27
  • jquery and jQM versions? – Omar Jul 10 '14 at 08:46
  • @Omar I don't understand your question Omar, sorry. – Phish Jul 10 '14 at 09:19
  • Jquery version 1.7,1.8,1.9, etc. jquery mobile 1.1,1.2,1.3,1.4? – Omar Jul 10 '14 at 09:36
  • @Omar ah sorry, I exagerrated the AND in your question and thought you were questioning the use of both together s: , JQ - 1.9.1 JQM - 1.3.2 – Phish Jul 10 '14 at 09:38
  • Use `.on()` not `.delegate()`. e.g. `$(document).on("pagebeforecreate", "#pageID", ...` but anyway, elements will be styled with jQM styles after that event. You want to prevent jQM from adding its own styles? – Omar Jul 10 '14 at 09:53

0 Answers0