简体   繁体   English

jQuery按名称选择选择器,不返回所选值

[英]jquery select selector by name not returning selected value

I'd created a fiddle and its working well. 我创建了一个小提琴,并且运作良好。 Also, it was working proper on my system until I'd uploaded it to server. 另外,在将其上载到服务器之前,它在我的系统上均正常运行。 The actual problem I'm getting is, wherever I'd used $('select[name=propType]').val() it always returning Residential . 我得到的实际问题是,无论我在哪里使用$('select[name=propType]').val()它总是返回Residential
I specially need that value on line 76 of javascript in fiddle . 我特别需要on line 76 of javascript in fiddle该值。

Why it is not returning the exact propType selected value on my localhost ? 为什么在我的localhost上不返回精确的propType选择值? I'd used proper IDs wherever expected. 我在期望的地方都使用了正确的ID。
Any reason of such behavior? 有这种行为的原因吗?

UPDATE 更新
The same code as of fiddle is not working on my site. fiddle相同的代码在我的网站上不起作用。

line 75 in fiddle-javascript
$('select[name=propType]').val() always returning Residential . $('select[name=propType]').val()始终返回Residential Why? 为什么?

Don't know why $('select[name=propType]').val() not properly working well with me. 不知道为什么$('select[name=propType]').val()与我无法正常工作。
I'd changed those selectors with id as $('#propType').val() and $(this).val() applicable where needed. 我已经更改了ID$('#propType').val()$(this).val()那些选择器,如果需要的话。

$('#property').change(function () 

Please bind using 请使用绑定

  $("body").delegate("#property", "change", function() {
   // your functionality come here
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM