Test messageI'm using CB Content to display input field and apply select2 to it.
In Text I have:
Code:
input id="blabla" type="text" /input
In jQuery I have:
Code:
.......some PHP with SQL code that assigns data to variable $data.........
var data = ?php echo $data; ?;
$('input#blabla').select2({
data: data
});
But each time in Console I have error:
Code:
Uncaught TypeError: jQuery(…).ready is not a function
or
Uncaught TypeError: jQuery(...).select2 is not a function
or
Uncaught SyntaxError: Unexpected token <
I suppose it's prohibited to input tags "<" and ">" in jQuery textarea,
but I need to execute my PHP code to put data in var data
How would I make this working?
PS: for now I've found a workaround by creating a PHP file and connecting it in Text textarea of CB Content. Inside I put all my PHP, SQL and JS variable var data:
Code:
script src="/file.php" /script