0

I've this code example, to define my problem : jsfiddle.net/Architecte/KSDCM/

Can you help me to call the select in question?

Do you know why I can not call an id that contains hooks? Do I need to perform a specific action to do this?

In fact if I renommme selct my id in a "normal", everything works perfectly.

But for me to validate my post later in this call, I have to keep these tables up.

Roukmoute
  • 681
  • 1
  • 11
  • 26
  • For your `name` attribute, you can use `[]` perfectly. They are not really allowed for `id` attributes: http://stackoverflow.com/questions/70579/what-are-valid-values-for-the-id-attribute-in-html – Bart Vangeneugden Oct 26 '11 at 13:24

4 Answers4

1

Escape the special characters with \\:

$('#f1\\[sector\\]')

See http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_by_an_ID_that_has_characters_used_in_CSS_notation.3F

Tetaxa
  • 4,375
  • 1
  • 19
  • 25
0

I think the problem is that you [ and ] in your elements id

Tx3
  • 6,796
  • 4
  • 37
  • 52
0

Like Tetaxas said, you can either escape special characters in the id, or use this selector instead

$('select[id="f1[sector]"]').html();

Here's a fiddle.

aziz punjani
  • 25,586
  • 9
  • 47
  • 56
0

use

$('#newtechnicalsheet').click(function() {
    alert($('select[id="f1[sector]"]').html());
});

or

$('#newtechnicalsheet').click(function() {
    alert($('select[name="f1[sector]"]').html());
});
Sedat Başar
  • 3,740
  • 3
  • 25
  • 28