在 wordpress 中使用简单代码时出现以下错误。知道如何解决这个问题吗?
错误:
Uncaught TypeError: Property '$' of object [object Object] is not a function
(anonymous function)
x.event.dispatch
v.handle
Javascript:
<script type="text/javascript">
jQuery('#room_type').change(function(){
var location = $(this).val(),
div = $('#' + location);
jQuery('div').hide();
div.show();
});
</script>
HTML:
<select id="room_type">
<option value="">-- Type --</option>
<option value="oneroom">One room</option>
<option value="tworoom">Two room</option>
</select>
<div id="oneroom" style="display:none">
CONTENT 1
</div>
<div id="tworoom" style="display:none">
CONTENT 2
</div>