Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12796 closed bug (notabug)

This script no longer works from jQuery 1.8 onwards

Reported by: limguowei@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

Description

$(document).ready(function(){$("#container").on("submit",".edit_question",function(){return!$("input[@name='question[answer]']:checked").val()||!$("input[@name='answer[]']:checked").val()?confirm("Are sure you want to submit a blank answer?"):!0})});

Is this deliberate or there is a substitute?

Change History (6)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

"input[@name='question[answer]']:checked"

I think the @ prefix for attributes was dropped in jQuery 1.2, back in 2008. It's not part of the W3C CSS selector syntax.

comment:2 Changed 7 years ago by limguowei@…

Hi I wish to clarify that the code works on JQuery 1.7.2 When I CDN the JQuery 1.7.2 library from google it works as intended When I CDN the JQuery 1.8.0 library from google it fails When I CDN the JQuery 1.8.1 library from google it fails When I CDN the JQuery 1.8.2 library from google it fails I tried your recommendation and remove the @ prefix again it fails.

comment:3 Changed 7 years ago by dmethvin

We would need a complete test case to reproduce the issue then. Please provide a link to either a jsbin.com or jsfiddle.net test case.

comment:4 Changed 7 years ago by limguowei@…

Hi I add a jsbin.com Test case here http://jsbin.com/onicuz/1/edit If you change the cdn google to 1.8.2 it fails and it works on 1.7.2

comment:5 Changed 7 years ago by dmethvin

Your selectors are invalid and they work correctly when the @ is removed. There is no bug. If you need more help ask for it on a forum.

comment:6 Changed 7 years ago by limguowei@…

If you remove the @ the alert gets trigger even if you selected a value on jQuery 1.8.2 which is NOT suppose to.

Note: See TracTickets for help on using tickets.