jQWidgets Forums

jQuery UI Widgets Forums General Discussions Lists DropDownList select Event Not Firing

This topic contains 1 reply, has 1 voice, and was last updated by  gush 9 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • select Event Not Firing #83315

    gush
    Participant

    Hi,

    I can’t get the ‘select’ event to fire.

    What am I doing wrong?
    Here’s my code:

    <!DOCTYPE html>
    <html lang="en">
    	<head>
    		<link href="jqx.base.css" rel="stylesheet"/>
    		<script src="jquery-2.1.4.js"></script>
    		<script src="jqx-all.js"></script>
    		<script>
    			$(document).ready(function () {
    				$('.isDropdown').each(function() {
    					$(this).jqxDropDownList({});
    					$(this).on('select', function(event) {
    						alert('woooohoooooo');
    					});
    				});
    			});
    		</script>
    	</head>
    	<body>
    		<select class="isDropdown">
    			<option value="1">roni</option>
    			<option value="2" selected>soni</option>
    			<option value="3">toni</option>
    		</select>
    		<br/>
    		<select class="isDropdown">
    			<option value="1">ronia</option>
    			<option value="2">sonia</option>
    			<option value="3">tonia</option>
    			<option value="4" selected>uonia</option>
    		</select>
    	</body>
    </html>
    select Event Not Firing #83316

    gush
    Participant

    Got it,

    Turns out, once I call jqxDropDownList on a select, the class ‘isDropdown’ is removed from the select element and added to a new div element created by jqxDropDownList.

    so here’s how it worked:

    <!DOCTYPE html>
    <html lang="en">
    	<head>
    		<link href="jqx.base.css" rel="stylesheet"/>
    		<script src="jquery-2.1.4.js"></script>
    		<script src="jqx-all.js"></script>
    		<script>
    			$(document).ready(function () {
    				$('.isDropdown').jqxDropDownList();
    
    				$('.isDropdown').on('select', function(event) {
    					alert(event.args.index);
    				});
    			});
    		</script>
    	</head>
    	<body>
    		<select class="isDropdown">
    			<option value="1">roni</option>
    			<option value="2" selected>soni</option>
    			<option value="3">toni</option>
    		</select>
    		<br/>
    		<select class="isDropdown">
    			<option value="1">ronia</option>
    			<option value="2">sonia</option>
    			<option value="3">tonia</option>
    			<option value="4" selected>uonia</option>
    		</select>
    	</body>
    </html>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.