javascript - jQuery throws uncaught error on smarty code -


i have following error message

uncaught error: syntax error, unrecognized expression: [value={if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if}] 

which originating code:

$('.id_state option[value={if isset($smarty.post.id_state) {$smarty.post.id_state|intval}{/if}]').prop('selected', true); 

i not sure why throws such error, since code following (literallly next line) works charm

the following code works normally

$('.id_state_invoice option[value={if isset($smarty.post.id_state_invoice)}{$smarty.post.id_state_invoice|intval}{/if}]').prop('selected', true); 

your code:

{if isset($smarty.post.id_state) {$smarty.post.id_state|intval}{/if} 

needs be:

{if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if} 

Comments

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -