In the initial part of my js code, I create element as below:
$('<input/>', {
type: 'text',
class: 'edit country',
handle: '123456',
name: 'customer'
})
Then I add it to dom.
Sometime later, I want to retrieve the info stored in this element:
$(input_element).prop('handle') #which return 'undefined'
$(input_element).attr('handle') #which give me '123456'
$(input_element).prop('name') #which return 'customer'
$(input_element).attr('name') #which give me 'customer'
I want to know what is wrong with my prop() method for fetching 'handle'? Is that because 'handle' is not standard HTML attribute?
I have read this post .prop() vs .attr() No big help.
Anyone have a clue?