Avishay28 Avishay28 - 2 years ago 72
Javascript Question

click() doesn't work with option tag

I want to target specific

by the option value, but seems that the click function doesn't work on

<select name="page_template" id="page_template">

<option value="default">regular template</option>
<option value="page-templates/100-full-width.php">100% Full Width Page</option>
<option value="templates/form-embed.php" selected="selected">Form Embed</option>
<option value="page-templates/full-width.php">Full Width Page</option>
<option value="templates/homepage.php">Homepage</option>






I want to check weather the option was clicked, regardless of weather it selected or not, as selected is set just after submitting the form.

Answer Source

Option tag doesn't have click event handler, use select's change event instead

    if ( $(this).val() == "templates/form-embed.php" )
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download