入力IDを渡して対応するタイプを取得しようとしています。IDを渡して入力タイプを取得
例:だから、 "1" 日付とパッシングを返す渡す
<input id = "1" type = "date"/>
<input id = "2" type = "text"/>
"2" テキストを返します。
私は、私の場合のために働くいくつかの例が、どれも見てきました:
How to use jquery selector having element type and ID
finding the type of an element using jQuery
私がこれまで持っている:
$("#my_select").on('click',function(){
var fieldID = document.querySelector('.selected').id
console.log("id is " + fieldID);
var elementType = $(this).prev().prop('.selected');
console.log("element type " + elementType)
});
のような他のタグのラジオテキストメールやタグ名のように、あなたの入力のためのタイプを与える文書全体で一意のIDがありますか? – juvian